Exception with Resolving assemblies: Attempt to load an unverifiable executable with fixups

11.9k views Asked by At

I'm embedding required assemblies to my project and resolving them on runtime with AppDomain.CurrentDomain.AssemblyResolve event.

All works okay except irrKlang's .net4-wrapper, which throws an exception if i try so;

System.IO.FileLoadException: Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)
   at System.Reflection.RuntimeAssembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection, SecurityContextSource securityContextSource)
   at System.Reflection.Assembly.Load(Byte[] rawAssembly)
   at xyz.Utility.Helpers.AssemblyManager.Resolver(Object sender, ResolveEventArgs args) in C:\Users\shalafi\Desktop\xyz\trunk\xyz\Utility\Helpers\AssemblyManager.cs:line 55
   at System.AppDomain.OnAssemblyResolveEvent(RuntimeAssembly assembly, String assemblyFullName)

Basicly i suspect of CLR not being able to load mixed mode assemblies with Assembly.Load(byte[]) though i'm not sure.

I was not able to find anything related to the exception message;

Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.)

Help appreciated.

2

There are 2 answers

3
Soundararajan On BEST ANSWER

EDIT : The references i posted are not valid anymore, because of outdated external links. Please refer here. How do I dynamically load raw assemblies that contains unmanaged code?(bypassing 'Unverifiable code failed policy check' exception)

0
Micah Vertal On

Just in case anyone else is having my version of this problem, here's how I fixed it:

  • Create a new project with a different name
  • Copy all of your files into the new project (including code)
  • Add references to all the files necessary to compile without errors

I really must have messed something up with my references/resources. I was getting this error when trying to load any external .dll from my program.