title: AppDomain.CurrentDomain.AssemblyResolve possible issues with trust or other gotcha's I should be aware of
body: <p>I'm currently using the following code:</p>
  
  <pre><code>AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =&gt; {
      var name = args.Name + ".dll";
      using (var input = Assembly.GetExecutingAssembly()
                                 .GetManifestResourceStream(name)) {
          Assembly dll = input != null
              ? Assembly.Load(input.ToArray())
              : null;
  
          return dll;
      }
  };
  </code></pre>
  
  <p>In all instances locally it seems to work just fine, however one client is having trouble loading the included dlls (they do not have source code access).</p>
  
  <p>Are there any trust issues or gotchas that I should be aware of when using this type of dynamic dll loading?</p>
  
  <p>Medium Trust issues don't seem to be an issue, however our resulting dll requires Full Trust anyway. I guess it might come down to Security Permissions or something.</p>
  
  <h2>Update</h2>
  
  <p>After going through the docs, again, I noticed a single line that I skipped over before and I think it's related to my problem.</p>
  
  <p>"Beginning with the .NET Framework 4, the ResolveEventHandler  event is raised for <strong>all assemblies</strong>, including resource assemblies. In earlier versions, the event was not raised for resource assemblies. If the operating system is localized, the handler might be called multiple times: once for each culture in the fallback chain."</p>
  
  <p>Whereas in 3.5 it wasn't. I'll post an updated when I confirm.</p>