Assemblies are loaded twice in a 64-bit application

On x64 applications, it seems that multiple assemblies are mapped twice to the process address space. Assemblies are loaded from the same location in the same load context. There are no explicit reflexive APIs or application domains.

This does not play for native DLLs or framework DLLs that have their own images (* .ni.dll), but it does not play for locally assembled assemblies and others such as System.Threading.Tasks.Dataflow.dll and StyleCop.dll.

It does not play when compiling a solution for x86.

I see duplicate entries in Process Explorer and VMMap. And when I break the load on the module in windbg, I see a different behavior when starting x64 vs x86.

NGENing builds doesn't make any difference.

To demonstrate, I put together a solution that creates an assembly and an executable that references this assembly. I can provide this code, but it is dead simply: the assembly provides an enumeration, and the EXE refers to the value in this enumeration and displays it.

When I create both the build and the exe-setup of x64 and run exe, I see duplicate entries in VMMap and Process Explorer. Both show that reference assemblies are on the same path. VMMap shows the .rsrc, .text, and Header sections for both records (along with 3 reserved blocks in each record).

When I create the same solution for x86 and run the EXE, I see 1 record for the build in VMMap and Process Explorer.

I ran both the 32-bit and 64-bit versions under windbg with the help of "sxe ld TestAssembly" in order to observe the loads of the breaking assembly.

In the stacks below you will see that in the 64-bit version there are 3 gaps and only 2 in the 32-bit version.

The first 2 stacks in the 64-bit version look similar to 2 in the 32-bit version, but the 3rd is unique to 64-bit ones.

Any ideas what is going on here? I know that 64 bit is 32 x 32 bit, but I did not expect assemblies to be downloaded twice! :)

I downloaded the solution to reproduce the problem here:

https://skydrive.live.com/redir?resid=3C60C20A37311DB4!969&authkey=!AJWx4Cm3XDWeu2M

The playback steps are included in this zip file, but if something is unclear, let me know!

In 64-bit form, here are the stacks when the assembly loads under windbg (sxe ld TestAssembly):

Microsoft (R) Windows Debugger Version 6.12.0002.633 AMD64 Copyright (c) Microsoft Corporation. All rights reserved. CommandLine: C:\src\DualAssemblyLoadTest\bin\x64\Debug\DualAssemblyLoadTest.exe ... 0:000> sxe ld TestAssembly 0:000> g (15ac.a9c): Unknown exception - code 04242420 (first chance) ModLoad: 000007fe`f3cf0000 000007fe`f3cf6000 TestAssembly.dll ntdll!ZwMapViewOfSection+0xa: 00000000`77b0159a c3 ret 0:000> k Child-SP RetAddr Call Site 00000000`00498e38 000007fe`fdfd3c90 ntdll!ZwMapViewOfSection+0xa 00000000`00498e40 00000000`773f316d KERNELBASE!MapViewOfFileEx+0x90 00000000`00498ec0 000007fe`f1558f22 KERNEL32!MapViewOfFileExStub+0x1d 00000000`00498f00 000007fe`f155ac0a clr!CLRMapViewOfFileEx+0x42 00000000`00498f80 000007fe`f155aa36 clr!MappedImageLayout::MappedImageLayout+0x166 00000000`00499270 000007fe`f152ada9 clr!PEImageLayout::Map+0x47 00000000`004992e0 000007fe`f152ad42 clr! ?? ::FNODOBFM::`string'+0x5b6d5 00000000`00499330 000007fe`f1518273 clr! ?? ::FNODOBFM::`string'+0x5b5ba 00000000`004993b0 000007fe`f1517c67 clr!RuntimeOpenImageInternal+0xc3 00000000`00499480 000007fe`f1517b83 clr!GetAssemblyMDInternalImportEx+0xd9 00000000`00499500 000007fe`f1565007 clr!CreateMetaDataImport+0x1b 00000000`00499540 000007fe`f1564f69 clr!CAssemblyManifestImport::InitAndLoadMetaData+0x63 00000000`00499590 000007fe`f1567b7f clr!CreateAssemblyManifestImport+0x99 00000000`004995e0 000007fe`f156862d clr!CAsmDownloadMgr::CreateAssembly+0x110 00000000`00499d90 000007fe`f1568243 clr!CAsmDownloadMgr::DoSetupRFS+0xc6 00000000`0049a1a0 000007fe`f1567e1c clr!CAsmDownloadMgr::DoSetup+0x1d0 00000000`0049a4b0 000007fe`f156672b clr!CAssemblyDownload::DoSetup+0xb8 00000000`0049a550 000007fe`f1566615 clr!CAssemblyDownload::DownloadComplete+0xbb 00000000`0049a5a0 000007fe`f1565094 clr!CAssemblyDownload::KickOffDownload+0x16d 00000000`0049a880 000007fe`f151c5df clr!CAssemblyName::BindToObject+0x543 00000000`0049a9d0 000007fe`f151c374 clr!FusionBind::RemoteLoad+0x1cf 00000000`0049ab00 000007fe`f151c0ba clr!FusionBind::LoadAssembly+0x1d4 00000000`0049ac20 000007fe`f151b3bd clr!AssemblySpec::FindAssemblyFile+0x116 00000000`0049b3b0 000007fe`f1527ba4 clr!AppDomain::BindAssemblySpec+0x35e 00000000`0049c5f0 000007fe`f15279fa clr!PEFile::LoadAssembly+0xe8 00000000`0049c720 000007fe`f155b8fe clr!Module::LoadAssembly+0x361 00000000`0049c9c0 000007fe`f14fd17b clr!Assembly::FindModuleByTypeRef+0x18f 00000000`0049cd10 000007fe`f14f02d9 clr!ClassLoader::LoadTypeDefOrRefThrowing+0x452 00000000`0049ce50 000007fe`eeb0950e clr!CEEInfo::resolveToken+0xc58 00000000`0049d520 000007fe`eeabaac7 clrjit!ReaderBase::readBytesForFlowGraphNode_Helper+0x1389 00000000`0049d940 000007fe`eeabf316 clrjit!ReaderBase::readBytesForFlowGraphNode+0x1a7 00000000`0049da10 000007fe`eeac0c65 clrjit!ReaderBase::MSILToIR+0x186 00000000`0049da70 000007fe`eeac0c06 clrjit!ReadProc+0x26 00000000`0049dc40 000007fe`eeaa5d27 clrjit!THX_dop2_ReadProc+0x36 00000000`0049dc70 000007fe`eeab732b clrjit!THX_dop2+0x77 00000000`0049dcf0 000007fe`f15d07ee clrjit!PreJit::compileMethod+0x67 00000000`0049dd70 000007fe`f15d073f clr!invokeCompileMethodHelper+0x6a 00000000`0049ddc0 000007fe`f15d062e clr!invokeCompileMethod+0x8f 00000000`0049de30 000007fe`f15d050c clr!CallCompileMethodWithSEHWrapper+0x46 00000000`0049dec0 000007fe`f154e88a clr!UnsafeJitFunction+0x23c 00000000`0049e440 000007fe`f1500971 clr!MethodDesc::MakeJitWorker+0x4ea 00000000`0049e690 000007fe`f14ffecb clr!MethodDesc::DoPrestub+0xb1c 00000000`0049eb70 000007fe`f14b24da clr!PreStubWorker+0x3eb 00000000`0049ee70 000007fe`f14ff713 clr!ThePreStub+0x5a 00000000`0049ef40 000007fe`f14ff242 clr!CallDescrWorkerInternal+0x83 00000000`0049ef80 000007fe`f14ff30b clr!CallDescrWorkerWithHandler+0x4a 00000000`0049efc0 000007fe`f169721c clr!MethodDescCallSite::CallTargetWorker+0x2e6 00000000`0049f170 000007fe`f1697976 clr!RunMain+0x1e7 00000000`0049f340 000007fe`f1697870 clr!Assembly::ExecuteMainMethod+0xb6 00000000`0049f630 000007fe`f16973e6 clr!SystemDomain::ExecuteMainMethod+0x45e 00000000`0049fbf0 000007fe`f169733e clr!ExecuteEXE+0x3f 00000000`0049fc60 000007fe`f1693ed4 clr!CorExeMainInternal+0xae 00000000`0049fcf0 000007fe`f99c74e5 clr!CorExeMain+0x14 00000000`0049fd30 000007fe`f9c65b21 mscoreei!CorExeMain+0xe0 00000000`0049fd80 00000000`773e652d MSCOREE!CorExeMain_Exported+0x57 00000000`0049fdb0 00000000`77adc521 KERNEL32!BaseThreadInitThunk+0xd 00000000`0049fde0 00000000`00000000 ntdll!RtlUserThreadStart+0x1d 0:000> g ModLoad: 00000000`006b0000 00000000`006b6000 TestAssembly.dll ntdll!ZwMapViewOfSection+0xa: 00000000`77b0159a c3 ret 0:000> k Child-SP RetAddr Call Site 00000000`00498e38 000007fe`fdfd3c90 ntdll!ZwMapViewOfSection+0xa 00000000`00498e40 00000000`773f316d KERNELBASE!MapViewOfFileEx+0x90 00000000`00498ec0 000007fe`f1558f22 KERNEL32!MapViewOfFileExStub+0x1d 00000000`00498f00 000007fe`f155ac6b clr!CLRMapViewOfFileEx+0x42 00000000`00498f80 000007fe`f155aa36 clr!MappedImageLayout::MappedImageLayout+0x1c7 00000000`00499270 000007fe`f152ada9 clr!PEImageLayout::Map+0x47 00000000`004992e0 000007fe`f152ad42 clr! ?? ::FNODOBFM::`string'+0x5b6d5 00000000`00499330 000007fe`f1518273 clr! ?? ::FNODOBFM::`string'+0x5b5ba 00000000`004993b0 000007fe`f1517c67 clr!RuntimeOpenImageInternal+0xc3 00000000`00499480 000007fe`f1517b83 clr!GetAssemblyMDInternalImportEx+0xd9 00000000`00499500 000007fe`f1565007 clr!CreateMetaDataImport+0x1b 00000000`00499540 000007fe`f1564f69 clr!CAssemblyManifestImport::InitAndLoadMetaData+0x63 00000000`00499590 000007fe`f1567b7f clr!CreateAssemblyManifestImport+0x99 00000000`004995e0 000007fe`f156862d clr!CAsmDownloadMgr::CreateAssembly+0x110 00000000`00499d90 000007fe`f1568243 clr!CAsmDownloadMgr::DoSetupRFS+0xc6 00000000`0049a1a0 000007fe`f1567e1c clr!CAsmDownloadMgr::DoSetup+0x1d0 00000000`0049a4b0 000007fe`f156672b clr!CAssemblyDownload::DoSetup+0xb8 00000000`0049a550 000007fe`f1566615 clr!CAssemblyDownload::DownloadComplete+0xbb 00000000`0049a5a0 000007fe`f1565094 clr!CAssemblyDownload::KickOffDownload+0x16d 00000000`0049a880 000007fe`f151c5df clr!CAssemblyName::BindToObject+0x543 00000000`0049a9d0 000007fe`f151c374 clr!FusionBind::RemoteLoad+0x1cf 00000000`0049ab00 000007fe`f151c0ba clr!FusionBind::LoadAssembly+0x1d4 00000000`0049ac20 000007fe`f151b3bd clr!AssemblySpec::FindAssemblyFile+0x116 00000000`0049b3b0 000007fe`f1527ba4 clr!AppDomain::BindAssemblySpec+0x35e 00000000`0049c5f0 000007fe`f15279fa clr!PEFile::LoadAssembly+0xe8 00000000`0049c720 000007fe`f155b8fe clr!Module::LoadAssembly+0x361 00000000`0049c9c0 000007fe`f14fd17b clr!Assembly::FindModuleByTypeRef+0x18f 00000000`0049cd10 000007fe`f14f02d9 clr!ClassLoader::LoadTypeDefOrRefThrowing+0x452 00000000`0049ce50 000007fe`eeb0950e clr!CEEInfo::resolveToken+0xc58 00000000`0049d520 000007fe`eeabaac7 clrjit!ReaderBase::readBytesForFlowGraphNode_Helper+0x1389 00000000`0049d940 000007fe`eeabf316 clrjit!ReaderBase::readBytesForFlowGraphNode+0x1a7 00000000`0049da10 000007fe`eeac0c65 clrjit!ReaderBase::MSILToIR+0x186 00000000`0049da70 000007fe`eeac0c06 clrjit!ReadProc+0x26 00000000`0049dc40 000007fe`eeaa5d27 clrjit!THX_dop2_ReadProc+0x36 00000000`0049dc70 000007fe`eeab732b clrjit!THX_dop2+0x77 00000000`0049dcf0 000007fe`f15d07ee clrjit!PreJit::compileMethod+0x67 00000000`0049dd70 000007fe`f15d073f clr!invokeCompileMethodHelper+0x6a 00000000`0049ddc0 000007fe`f15d062e clr!invokeCompileMethod+0x8f 00000000`0049de30 000007fe`f15d050c clr!CallCompileMethodWithSEHWrapper+0x46 00000000`0049dec0 000007fe`f154e88a clr!UnsafeJitFunction+0x23c 00000000`0049e440 000007fe`f1500971 clr!MethodDesc::MakeJitWorker+0x4ea 00000000`0049e690 000007fe`f14ffecb clr!MethodDesc::DoPrestub+0xb1c 00000000`0049eb70 000007fe`f14b24da clr!PreStubWorker+0x3eb 00000000`0049ee70 000007fe`f14ff713 clr!ThePreStub+0x5a 00000000`0049ef40 000007fe`f14ff242 clr!CallDescrWorkerInternal+0x83 00000000`0049ef80 000007fe`f14ff30b clr!CallDescrWorkerWithHandler+0x4a 00000000`0049efc0 000007fe`f169721c clr!MethodDescCallSite::CallTargetWorker+0x2e6 00000000`0049f170 000007fe`f1697976 clr!RunMain+0x1e7 00000000`0049f340 000007fe`f1697870 clr!Assembly::ExecuteMainMethod+0xb6 00000000`0049f630 000007fe`f16973e6 clr!SystemDomain::ExecuteMainMethod+0x45e 00000000`0049fbf0 000007fe`f169733e clr!ExecuteEXE+0x3f 00000000`0049fc60 000007fe`f1693ed4 clr!CorExeMainInternal+0xae 00000000`0049fcf0 000007fe`f99c74e5 clr!CorExeMain+0x14 00000000`0049fd30 000007fe`f9c65b21 mscoreei!CorExeMain+0xe0 00000000`0049fd80 00000000`773e652d MSCOREE!CorExeMain_Exported+0x57 00000000`0049fdb0 00000000`77adc521 KERNEL32!BaseThreadInitThunk+0xd 00000000`0049fde0 00000000`00000000 ntdll!RtlUserThreadStart+0x1d 0:000> g ModLoad: 000007fe`f3cf0000 000007fe`f3cf6000 C:\src\DualAssemblyLoadTest\bin\x64\Debug\TestAssembly.dll ntdll!ZwMapViewOfSection+0xa: 00000000`77b0159a c3 ret 0:000> k Child-SP RetAddr Call Site 00000000`0049b468 00000000`77aeacfc ntdll!ZwMapViewOfSection+0xa 00000000`0049b470 00000000`77ae1327 ntdll!LdrpMapViewOfSection+0xbc 00000000`0049b520 00000000`77ad7cc8 ntdll!LdrpFindOrMapDll+0x469 00000000`0049b6a0 00000000`77ad7b2e ntdll!LdrpLoadDll+0x148 00000000`0049b8b0 000007fe`fdfcc71f ntdll!LdrLoadDll+0x9a 00000000`0049b920 000007fe`f150bf54 KERNELBASE!LoadLibraryExW+0x22e 00000000`0049b990 000007fe`f150bec1 clr!CLRLoadLibraryEx+0xfc 00000000`0049b9e0 000007fe`f152c30f clr!CLRLoadLibraryEx+0x51 00000000`0049ba30 000007fe`f152c264 clr!LoadedImageLayout::LoadedImageLayout+0x9e 00000000`0049bce0 000007fe`f155b133 clr!PEImageLayout::Load+0x3d 00000000`0049bd20 000007fe`f155af5e clr!PEImage::Load+0x119 00000000`0049bda0 000007fe`f152372c clr!PEFile::LoadLibrary+0xe2 00000000`0049bdd0 000007fe`f15236cf clr!DomainFile::LoadLibrary+0x59 00000000`0049be20 000007fe`f1521078 clr!DomainFile::DoIncrementalLoad+0xf6 00000000`0049be50 000007fe`f1521463 clr!AppDomain::TryIncrementalLoad+0x145 00000000`0049c250 000007fe`f1519c38 clr!AppDomain::LoadDomainFile+0x167 00000000`0049c310 000007fe`f1519a7b clr!AppDomain::LoadDomainAssemblyInternal+0x178 00000000`0049c400 000007fe`f1527a9c clr!AppDomain::LoadDomainAssembly+0x8c 00000000`0049c720 000007fe`f155b8fe clr!Module::LoadAssembly+0x403 00000000`0049c9c0 000007fe`f14fd17b clr!Assembly::FindModuleByTypeRef+0x18f 00000000`0049cd10 000007fe`f14f02d9 clr!ClassLoader::LoadTypeDefOrRefThrowing+0x452 00000000`0049ce50 000007fe`eeb0950e clr!CEEInfo::resolveToken+0xc58 00000000`0049d520 000007fe`eeabaac7 clrjit!ReaderBase::readBytesForFlowGraphNode_Helper+0x1389 00000000`0049d940 000007fe`eeabf316 clrjit!ReaderBase::readBytesForFlowGraphNode+0x1a7 00000000`0049da10 000007fe`eeac0c65 clrjit!ReaderBase::MSILToIR+0x186 00000000`0049da70 000007fe`eeac0c06 clrjit!ReadProc+0x26 00000000`0049dc40 000007fe`eeaa5d27 clrjit!THX_dop2_ReadProc+0x36 00000000`0049dc70 000007fe`eeab732b clrjit!THX_dop2+0x77 00000000`0049dcf0 000007fe`f15d07ee clrjit!PreJit::compileMethod+0x67 00000000`0049dd70 000007fe`f15d073f clr!invokeCompileMethodHelper+0x6a 00000000`0049ddc0 000007fe`f15d062e clr!invokeCompileMethod+0x8f 00000000`0049de30 000007fe`f15d050c clr!CallCompileMethodWithSEHWrapper+0x46 00000000`0049dec0 000007fe`f154e88a clr!UnsafeJitFunction+0x23c 00000000`0049e440 000007fe`f1500971 clr!MethodDesc::MakeJitWorker+0x4ea 00000000`0049e690 000007fe`f14ffecb clr!MethodDesc::DoPrestub+0xb1c 00000000`0049eb70 000007fe`f14b24da clr!PreStubWorker+0x3eb 00000000`0049ee70 000007fe`f14ff713 clr!ThePreStub+0x5a 00000000`0049ef40 000007fe`f14ff242 clr!CallDescrWorkerInternal+0x83 00000000`0049ef80 000007fe`f14ff30b clr!CallDescrWorkerWithHandler+0x4a 00000000`0049efc0 000007fe`f169721c clr!MethodDescCallSite::CallTargetWorker+0x2e6 00000000`0049f170 000007fe`f1697976 clr!RunMain+0x1e7 00000000`0049f340 000007fe`f1697870 clr!Assembly::ExecuteMainMethod+0xb6 00000000`0049f630 000007fe`f16973e6 clr!SystemDomain::ExecuteMainMethod+0x45e 00000000`0049fbf0 000007fe`f169733e clr!ExecuteEXE+0x3f 00000000`0049fc60 000007fe`f1693ed4 clr!CorExeMainInternal+0xae 00000000`0049fcf0 000007fe`f99c74e5 clr!CorExeMain+0x14 00000000`0049fd30 000007fe`f9c65b21 mscoreei!CorExeMain+0xe0 00000000`0049fd80 00000000`773e652d MSCOREE!CorExeMain_Exported+0x57 00000000`0049fdb0 00000000`77adc521 KERNEL32!BaseThreadInitThunk+0xd 00000000`0049fde0 00000000`00000000 ntdll!RtlUserThreadStart+0x1d 0:000> g 

At 32 bits, here are the stacks when the assembly loads under windbg (sxe ld TestAssembly):

 Microsoft (R) Windows Debugger Version 6.12.0002.633 X86 Copyright (c) Microsoft Corporation. All rights reserved. CommandLine: bin\x86\Debug\DualAssemblyLoadTest.exe ... 0:000> sxe ld TestAssembly 0:000> g (14cc.15fc): Unknown exception - code 04242420 (first chance) ModLoad: 60350000 60358000 TestAssembly.dll eax=00000000 ebx=0084a1fc ecx=00000000 edx=00000000 esi=00000000 edi=00000000 eip=77cafc42 esp=0042adac ebp=0042ade4 iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246 ntdll!NtMapViewOfSection+0x12: 77cafc42 83c404 add esp,4 0:000> k ChildEBP RetAddr 0042adac 7720e231 ntdll!NtMapViewOfSection+0x12 0042ade4 6e337b8d KERNELBASE!MapViewOfFileEx+0x81 0042ae3c 6e337d52 clr!CLRMapViewOfFileEx+0x26 0042b0ac 6e337e7c clr!MappedImageLayout::MappedImageLayout+0x200 0042b0f4 6e335ca1 clr!PEImageLayout::Map+0x2c 0042b12c 6e335d3e clr!PEImage::GetLayoutInternal+0x106 0042b17c 6e3320e6 clr!PEImage::GetLayout+0xf0 0042b200 6e33300f clr!RuntimeOpenImageInternal+0x9d 0042b250 6e35a512 clr!GetAssemblyMDInternalImportEx+0xe6 0042b288 6e35a5c6 clr!CAssemblyManifestImport::InitAndLoadMetaData+0x59 0042b2bc 6e35ca67 clr!CreateAssemblyManifestImport+0x50 0042b97c 6e35d240 clr!CAsmDownloadMgr::CreateAssembly+0x20a 0042bce4 6e35cf5e clr!CAsmDownloadMgr::DoSetupRFS+0xbf 0042bf9c 6e35cd0b clr!CAsmDownloadMgr::DoSetup+0x22f 0042bffc 6e35a6d7 clr!CAssemblyDownload::DoSetup+0xa4 0042c03c 6e35a894 clr!CAssemblyDownload::DownloadComplete+0x103 0042c2b0 6e35a920 clr!CAssemblyDownload::KickOffDownload+0x33a 0042c350 6e32784b clr!CAssemblyName::BindToObject+0x9c1 0042c3ec 6e327a7d clr!FusionBind::RemoteLoad+0x1fc 0042c478 6e327c30 clr!FusionBind::LoadAssembly+0x17c 0042cb54 6e327e6f clr!AssemblySpec::FindAssemblyFile+0x104 0042d87c 6e325299 clr!AppDomain::BindAssemblySpec+0xffd 0042d934 6e325103 clr!PEFile::LoadAssembly+0xc0 0042da08 6e3252e4 clr!Module::LoadAssembly+0x176 0042dca8 6e2f91ca clr!Assembly::FindModuleByTypeRef+0x1f5 0042dd14 6e304c27 clr!ClassLoader::LoadTypeDefOrRefThrowing+0x103 0042ddbc 751d10cf clr!CEEInfo::resolveToken+0x306 0042ddcc 751fffe8 clrjit!Compiler::impResolveToken+0x3a 0042e4fc 751d1a60 clrjit!Compiler::impImportBlockCode+0x42f5 0042e57c 751d1c42 clrjit!Compiler::impImportBlock+0x5d 0042e594 751d244d clrjit!Compiler::impImport+0x1ea 0042e5b4 751d401c clrjit!Compiler::compCompile+0x63 0042e5f0 751d4132 clrjit!Compiler::compCompileHelper+0x2fa 0042e668 751d4282 clrjit!Compiler::compCompile+0x213 0042e758 751d4595 clrjit!jitNativeCode+0x1cc 0042e77c 6e303669 clrjit!CILJit::compileMethod+0x25 0042e7cc 6e303701 clr!invokeCompileMethodHelper+0x41 0042e80c 6e303743 clr!invokeCompileMethod+0x31 0042e870 6e30399c clr!CallCompileMethodWithSEHWrapper+0x2a 0042ec08 6e303496 clr!UnsafeJitFunction+0x3ca 0042ecec 6e3040db clr!MethodDesc::MakeJitWorker+0x3a9 0042ed60 6e2ebcd5 clr!MethodDesc::DoPrestub+0x59d 0042edc8 6e2d2ae9 clr!PreStubWorker+0xed 0042edf8 6e2d2652 clr!ThePreStub+0x16 0042ee04 6e2e264f clr!CallDescrWorkerInternal+0x34 0042ee58 6e2e2e95 clr!CallDescrWorkerWithHandler+0x6b 0042eed0 6e3974ec clr!MethodDescCallSite::CallTargetWorker+0x152 0042effc 6e397610 clr!RunMain+0x1aa 0042f270 6e421dc4 clr!Assembly::ExecuteMainMethod+0x124 0042f774 6e421e67 clr!SystemDomain::ExecuteMainMethod+0x614 0042f7d0 6e421f7a clr!ExecuteEXE+0x4c 0042f810 6e42416a clr!_CorExeMainInternal+0xdc 0042f84c 70e2f5a3 clr!_CorExeMain+0x4d 0042f888 70ea7f16 mscoreei!_CorExeMain+0x10a 0042f898 70ea4de3 MSCOREE!ShellShim__CorExeMain+0x99 0042f8a0 7574339a MSCOREE!_CorExeMain_Exported+0x8 0042f8ac 77cc9ef2 KERNEL32!BaseThreadInitThunk+0xe 0042f8ec 77cc9ec5 ntdll!__RtlUserThreadStart+0x70 0042f904 00000000 ntdll!_RtlUserThreadStart+0x1b 0:000> g ModLoad: 001e0000 001e8000 TestAssembly.dll eax=00000000 ebx=0084a1fc ecx=00000000 edx=00000000 esi=00000000 edi=00000000 eip=77cafc42 esp=0042adac ebp=0042ade4 iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246 ntdll!NtMapViewOfSection+0x12: 77cafc42 83c404 add esp,4 0:000> k ChildEBP RetAddr 0042adac 7720e231 ntdll!NtMapViewOfSection+0x12 0042ade4 6e337b8d KERNELBASE!MapViewOfFileEx+0x81 0042ae3c 6e337d7d clr!CLRMapViewOfFileEx+0x26 0042b0ac 6e337e7c clr!MappedImageLayout::MappedImageLayout+0x227 0042b0f4 6e335ca1 clr!PEImageLayout::Map+0x2c 0042b12c 6e335d3e clr!PEImage::GetLayoutInternal+0x106 0042b17c 6e3320e6 clr!PEImage::GetLayout+0xf0 0042b200 6e33300f clr!RuntimeOpenImageInternal+0x9d 0042b250 6e35a512 clr!GetAssemblyMDInternalImportEx+0xe6 0042b288 6e35a5c6 clr!CAssemblyManifestImport::InitAndLoadMetaData+0x59 0042b2bc 6e35ca67 clr!CreateAssemblyManifestImport+0x50 0042b97c 6e35d240 clr!CAsmDownloadMgr::CreateAssembly+0x20a 0042bce4 6e35cf5e clr!CAsmDownloadMgr::DoSetupRFS+0xbf 0042bf9c 6e35cd0b clr!CAsmDownloadMgr::DoSetup+0x22f 0042bffc 6e35a6d7 clr!CAssemblyDownload::DoSetup+0xa4 0042c03c 6e35a894 clr!CAssemblyDownload::DownloadComplete+0x103 0042c2b0 6e35a920 clr!CAssemblyDownload::KickOffDownload+0x33a 0042c350 6e32784b clr!CAssemblyName::BindToObject+0x9c1 0042c3ec 6e327a7d clr!FusionBind::RemoteLoad+0x1fc 0042c478 6e327c30 clr!FusionBind::LoadAssembly+0x17c 0042cb54 6e327e6f clr!AssemblySpec::FindAssemblyFile+0x104 0042d87c 6e325299 clr!AppDomain::BindAssemblySpec+0xffd 0042d934 6e325103 clr!PEFile::LoadAssembly+0xc0 0042da08 6e3252e4 clr!Module::LoadAssembly+0x176 0042dca8 6e2f91ca clr!Assembly::FindModuleByTypeRef+0x1f5 0042dd14 6e304c27 clr!ClassLoader::LoadTypeDefOrRefThrowing+0x103 0042ddbc 751d10cf clr!CEEInfo::resolveToken+0x306 0042ddcc 751fffe8 clrjit!Compiler::impResolveToken+0x3a 0042e4fc 751d1a60 clrjit!Compiler::impImportBlockCode+0x42f5 0042e57c 751d1c42 clrjit!Compiler::impImportBlock+0x5d 0042e594 751d244d clrjit!Compiler::impImport+0x1ea 0042e5b4 751d401c clrjit!Compiler::compCompile+0x63 0042e5f0 751d4132 clrjit!Compiler::compCompileHelper+0x2fa 0042e668 751d4282 clrjit!Compiler::compCompile+0x213 0042e758 751d4595 clrjit!jitNativeCode+0x1cc 0042e77c 6e303669 clrjit!CILJit::compileMethod+0x25 0042e7cc 6e303701 clr!invokeCompileMethodHelper+0x41 0042e80c 6e303743 clr!invokeCompileMethod+0x31 0042e870 6e30399c clr!CallCompileMethodWithSEHWrapper+0x2a 0042ec08 6e303496 clr!UnsafeJitFunction+0x3ca 0042ecec 6e3040db clr!MethodDesc::MakeJitWorker+0x3a9 0042ed60 6e2ebcd5 clr!MethodDesc::DoPrestub+0x59d 0042edc8 6e2d2ae9 clr!PreStubWorker+0xed 0042edf8 6e2d2652 clr!ThePreStub+0x16 0042ee04 6e2e264f clr!CallDescrWorkerInternal+0x34 0042ee58 6e2e2e95 clr!CallDescrWorkerWithHandler+0x6b 0042eed0 6e3974ec clr!MethodDescCallSite::CallTargetWorker+0x152 0042effc 6e397610 clr!RunMain+0x1aa 0042f270 6e421dc4 clr!Assembly::ExecuteMainMethod+0x124 0042f774 6e421e67 clr!SystemDomain::ExecuteMainMethod+0x614 0042f7d0 6e421f7a clr!ExecuteEXE+0x4c 0042f810 6e42416a clr!_CorExeMainInternal+0xdc 0042f84c 70e2f5a3 clr!_CorExeMain+0x4d 0042f888 70ea7f16 mscoreei!_CorExeMain+0x10a 0042f898 70ea4de3 MSCOREE!ShellShim__CorExeMain+0x99 0042f8a0 7574339a MSCOREE!_CorExeMain_Exported+0x8 0042f8ac 77cc9ef2 KERNEL32!BaseThreadInitThunk+0xe 0042f8ec 77cc9ec5 ntdll!__RtlUserThreadStart+0x70 0042f904 00000000 ntdll!_RtlUserThreadStart+0x1b 0:000> g 

Here, the information from VMMap shows one assembly loaded twice in the process, with the same partitions loaded both times.

 Address Type Size Committed Private Total WS Private WS Shareable WS Shared WS Locked WS Blocks Protection Details 00000000006B0000 Image (ASLR) 24 12 8 8 8 6 Execute/Read C:\src\DualAssemblyLoadTest\bin\x64\Debug\TestAssembly.dll 00000000006B1000 Image (ASLR) 4 Reserved 00000000006B3000 Image (ASLR) 4 Reserved 00000000006B5000 Image (ASLR) 4 Reserved 00000000006B4000 Image (ASLR) 4 4 Read .rsrc 00000000006B2000 Image (ASLR) 4 4 4 4 4 Execute/Read .text 00000000006B0000 Image (ASLR) 4 4 4 4 4 Read Header 000007FEF3CF0000 Image (ASLR) 24 12 8 8 8 6 Execute/Read C:\src\DualAssemblyLoadTest\bin\x64\Debug\TestAssembly.dll 000007FEF3CF1000 Image (ASLR) 4 Reserved 000007FEF3CF3000 Image (ASLR) 4 Reserved 000007FEF3CF5000 Image (ASLR) 4 Reserved 000007FEF3CF4000 Image (ASLR) 4 4 Read .rsrc 000007FEF3CF2000 Image (ASLR) 4 4 4 4 4 Execute/Read .text 000007FEF3CF0000 Image (ASLR) 4 4 4 4 4 Read Header 

Update (20.Jan.2014):

The CLR team responded to my Connect message :

"Thank you for reporting this issue. We fixed it for the next major version of the .NET Framework."

+8
clr
source share

No one has answered this question yet.

See related questions:

1424
How to fix "No breakpoint will be deleted at this time. No characters have been loaded for this document." a warning?
890
How can I get the application path in a .NET console application?
818
ASP.NET website or ASP.NET web application?
805
How to make a .NET application run as an administrator?
780
How to enable assembly failure logging (Fusion) in .NET.
737
How to get the build path where the code is located?
677
How to get assembly file version
658
MetadataException: Unable to load the specified metadata resource
419
Resolution MSB3247 - Conflicts detected between different versions of the same dependent assembly
2
Strange exception in WCF service

All Articles