jbevain / mono.reflection

Some useful reflection helpers, including an IL disassembler.
151 stars 51 forks source link

DLL produced causes LoaderException during AssemblyLoad in vNext #9

Closed chuckbeasley closed 8 years ago

chuckbeasley commented 9 years ago

I load an assembly as follows: AssemblyDefinition asm2 = MetadataMapper.MapAssembly(AppDomain.CurrentDomain.GetAssemblies().Where(x => x.FullName == "Ats.OpenOne.Web.Controllers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null").First());

That part works fine. Next, I write the DLL out to a file, as follows: asm2.Write(@"C:\Source\Workspace\Ats.OpenOne\artifacts\bin\" + projectNames[10] + @"\Debug\dnx451\" + projectNames[10] + "_.dll");

When I attempt to load the assembly into memory, I get a LoaderException upon hitting this code: Assembly onDiskAssembly2 = Assembly.LoadFile(@"C:\Source\Workspace\Ats.OpenOne\artifacts\bin\" + projectNames[10] + @"\Debug\dnx451\" + projectNames[10] + "_.dll");

I've researched into this and the main difference I see is MetadataSystem is null, but is populated when I load a DLL written by Mono Cecil from disk.

jbevain commented 9 years ago

@chuckbeasley hey Chuck, can you upload the assembly somewhere? Thanks!

chuckbeasley commented 9 years ago

@jbevain Hey JB. Check your inbox.

jbevain commented 9 years ago

@chuckbeasley got it thanks, it might be a while before I get to it.

chuckbeasley commented 9 years ago

@jbevain cool! anyplace you recommend I start looking?

jbevain commented 8 years ago

Should be fixed in 15ba007af7d639821784b7b6c3648836ef197165