title: WinForm crashing when accessing resources
body: <p>I am developing a WinForm application and I have some embedded resources (the graphic layout of the form). The problem is that when I start the application on my machine it runs perfectly, but if I pass it on another pc it may or may not work. On the last computer I tried (Windows 7 64bit, .NET 4.0 installed) it blocked when I tried to access resources. Here is the code which blocks the app, and below there is the full exception thrown.</p>
  
  <pre><code>//Note: notifierName is a string passed as an argument
  _icon = new NotifyIcon
  {
      Text = notifierName,
      Icon = SystemIcons.Application,//Properties.Resources.Tray,
      Visible = true
  };
  try
  {
      _icon.Icon = Properties.Resources.Tray;
  }
  catch (Exception e)
  {
      Logger.WriteLog(e.ToString());
  }
  </code></pre>
  
  <p>After tracking down what was causing the exception, I tried to set all resources to "embedded resources", the .exe was doubled in size (so the images were actually saved in there) but the same error occurred. I think I'm missing something about how resources work, because passing the same exe on another machine isn't causing all these troubles. Thanks for your help.</p>
  
  <blockquote>
    <p>System.TypeLoadException: Unable to load type 'System.Runtime.CompilerServices.ExtensionAttribute' dall'assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
       in System.ModuleHandle.ResolveMethod(RuntimeModule module, Int32 methodToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount)
       in System.ModuleHandle.ResolveMethodHandleInternalCore(RuntimeModule module, Int32 methodToken, IntPtr[] typeInstantiationContext, Int32 typeInstCount, IntPtr[] methodInstantiationContext, Int32 methodInstCount)
       in System.ModuleHandle.ResolveMethodHandleInternal(RuntimeModule module, Int32 methodToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
       in System.Reflection.CustomAttributeData..ctor(RuntimeModule scope, CustomAttributeRecord caRecord)
       in System.Reflection.CustomAttributeData.GetCustomAttributes(RuntimeModule module, Int32 tkTarget)
       in System.Reflection.CustomAttributeData.GetCustomAttributesInternal(RuntimeAssembly target)
       in System.Resources.ManifestBasedResourceGroveler.GetNeutralResourcesLanguage(Assembly a, UltimateResourceFallbackLocation&amp; fallbackLocation)
       in System.Resources.ResourceManager.CommonSatelliteAssemblyInit()
       in System.Resources.ResourceManager..ctor(String baseName, Assembly assembly)
       in PatcherNET4.Properties.Resources.get_ResourceManager()
       in PatcherNET4.CustomControls.Notifier.Create(String notifierName)</p>
  </blockquote>