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

2

22

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.

Limit answered 15/2, 2011 at 15:12 Comment(6)
seems this there's no work-around for this: books.google.com/…Limit
Solution is that you change C++ assembly from EXE to DLL! There is probably some linker optimization during EXE loading which is not supported by CLR loader. See: zamboch.blogspot.com/2007/11/…Mammalogy
c++ assembly i use is already a dll..Limit
related: #2945580Proportionate
Thank you HuseyinUslu for posting that book page. Led me to change the CLR mode from normal to pure. resolved my issue!Generalization
I had the same issue, I just changed projects to same platform and it worked.Monda
A
5

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)

Abase answered 21/5, 2012 at 21:16 Comment(3)
I found that you can see part of it at the related question #2945580Alcine
Microsoft Connect stopped, please fix link @AbaseHawsehole
@NoahHeber The link is not available and nor the Microsoft Collaborate website has setup the link. After reviewing the post that porges posted has valuable information about the error.Abase
G
0

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.

Grovergroves answered 20/7, 2016 at 17:32 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.