title: KERNELBASE.dll error running c# app on Windows Server 2008 R2?
body: <p>I have a .NET 3.5 executable, compiled with 'Any CPU' and when I attempt to run it on Windows Server 2008 x64 R2 - It gives me:</p>
  
  <pre><code>Faulting application name: mcb.exe, version: 0.1.0.8, time stamp: 0x4e08e871
  Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdfe0
  </code></pre>
  
  <p>Has anyone else encountered/solved this issue?</p>
  
  <p>I suspect the DLLImports is that it doesn't even make it to main() --
  I should also add that this works fine on non-R2 Win Server 2008 x64</p>
  
  <p><strong>EDIT</strong>: Nevermind -- the dll import doesn't appear to be the cause of the issue --
  I commented it out and tried it, the same behavior occurred.
  Renaming question.</p>
  
  <p><strong>EDIT II</strong>: This kernel base dll error seems to be rather common but I can't find any reason why.</p>
  
  <p>Complete error per request:</p>
  
  <pre><code>Faulting application name: mcb.exe, version: 0.1.0.8, time stamp: 0x4e08eb21
  Faulting module name: KERNELBASE.dll, version: 6.1.7600.16385, time stamp: 0x4a5bdfe0
  Exception code: 0xe0434f4d
  Fault offset: 0x000000000000aa7d
  Faulting process id: 0x%9
  Faulting application start time: 0x%10
  Faulting application path: %11
  Faulting module path: %12
  Report Id: %13
  </code></pre>
  
  <p>I can't attach a debugger in time and cannot install VS on faulting machine :-(</p>
  
  <p>Here is the windbg output, I'm afraid it is just gibberish to me... I don't know if anyone can make sense of it.</p>
  
  <pre><code>Executable search path is: 
  ModLoad: 00000000`01180000 00000000`0132c000   mcb.exe 
  ModLoad: 00000000`77710000 00000000`778bc000   ntdll.dll
  ModLoad: 000007fe`f4dc0000 000007fe`f4e2f000   C:\Windows\SYSTEM32\MSCOREE.DLL
  ModLoad: 00000000`775f0000 00000000`7770f000   C:\Windows\system32\KERNEL32.dll
  ModLoad: 000007fe`fd8f0000 000007fe`fd95b000   C:\Windows\system32\KERNELBASE.dll
  (1870.15fc): Break instruction exception - code 80000003 (first chance)
  *** ERROR: Symbol file could not be found.  Defaulted to export symbols for ntdll.dll - 
  ntdll!CsrSetPriorityClass+0x40:
  00000000`777c0fb0 cc              int     3
  0:000&gt; g
  ModLoad: 000007fe`fd500000 000007fe`fd557000   C:\Windows\system32\apphelp.dll
  ModLoad: 000007fe`fea90000 000007fe`feb6b000   C:\Windows\system32\ADVAPI32.dll
  ModLoad: 000007fe`fde60000 000007fe`fdeff000   C:\Windows\system32\msvcrt.dll
  ModLoad: 000007fe`feb70000 000007fe`feb8f000   C:\Windows\SYSTEM32\sechost.dll
  ModLoad: 000007fe`fdcb0000 000007fe`fddde000   C:\Windows\system32\RPCRT4.dll
  ModLoad: 000007fe`fe7f0000 000007fe`fe861000   C:\Windows\system32\SHLWAPI.dll
  ModLoad: 000007fe`ff9b0000 000007fe`ffa17000   C:\Windows\system32\GDI32.dll
  ModLoad: 00000000`774f0000 00000000`775ea000   C:\Windows\system32\USER32.dll
  ModLoad: 000007fe`fda40000 000007fe`fda4e000   C:\Windows\system32\LPK.dll
  ModLoad: 000007fe`fe9c0000 000007fe`fea8a000   C:\Windows\system32\USP10.dll
  ModLoad: 000007fe`ff980000 000007fe`ff9ae000   C:\Windows\system32\IMM32.DLL
  ModLoad: 000007fe`fe2e0000 000007fe`fe3e9000   C:\Windows\system32\MSCTF.dll
  ModLoad: 000007fe`f3cc0000 000007fe`f466e000   C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
  ModLoad: 00000000`75370000 00000000`75439000   C:\Windows\WinSxS\amd64_microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4927_none_88dce9872fb18caf\MSVCR80.dll
  ModLoad: 000007fe`feb90000 000007fe`ff916000   C:\Windows\system32\shell32.dll
  ModLoad: 000007fe`fe0d0000 000007fe`fe2d2000   C:\Windows\system32\ole32.dll
  ModLoad: 000007fe`fd670000 000007fe`fd67f000   C:\Windows\system32\profapi.dll
  ModLoad: 000007fe`f27e0000 000007fe`f36bb000   C:\Windows\assembly\NativeImages_v2.0.50727_64\mscorlib\10e3a3015e967b69f90d58230a694f67\mscorlib.ni.dll
  ModLoad: 000007fe`fd560000 000007fe`fd56f000   C:\Windows\system32\CRYPTBASE.dll
  ModLoad: 000007fe`f2650000 000007fe`f27d4000   C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorjit.dll
  ModLoad: 00000642`ff4a0000 00000642`ff4aa000   C:\Windows\Microsoft.NET\Framework64\v2.0.50727\culture.dll
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): CLR exception - code e0434f4d (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): CLR exception - code e0434f4d (first chance)
  ModLoad: 000007fe`f1c30000 000007fe`f264e000   C:\Windows\assembly\NativeImages_v2.0.50727_64\System\98ac7ad6dcf7484bf8b4478ea6951cb6\System.ni.dll
  ModLoad: 000007fe`f19f0000 000007fe`f1c27000   C:\Windows\assembly\NativeImages_v2.0.50727_64\System.Drawing\62f46b8689863e5f23b1b69fe9c92eaf\System.Drawing.ni.dll
  ModLoad: 000007fe`f0950000 000007fe`f19e6000   C:\Windows\assembly\NativeImages_v2.0.50727_64\System.Windows.Forms\1109b73499e4e9b612bf55e2014d94df\System.Windows.Forms.ni.dll
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): CLR exception - code e0434f4d (first chance)
  (1870.15fc): C++ EH exception - code e06d7363 (first chance)
  (1870.15fc): CLR exception - code e0434f4d (first chance)
  (1870.15fc): CLR exception - code e0434f4d (!!! second chance !!!)
  *** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\KERNELBASE.dll - 
  KERNELBASE!RaiseException+0x3d:
  000007fe`fd8faa7d 4881c4c8000000  add     rsp,0C8h
  </code></pre>
  
  <p>More information:</p>
  
  <pre><code>0:000&gt; |* ~* kp
  
  .  0  Id: 198c.1874 Suspend: 1 Teb: 000007ff`fffde000 Unfrozen
  Child-SP          RetAddr           Call Site
  00000000`0043a8c0 00000000`753a96d0 KERNELBASE!RaiseException+0x39
  00000000`0043a990 00000000`7775f001 MSVCR80!_CxxCallCatchBlock+0x180
  00000000`0043aa40 000007fe`f3e721da ntdll!RcFrameConsolidation+0x3
  00000000`0043e640 000007fe`f3e3543f mscorwks!MethodDesc::MakeJitWorker+0x1ea
  00000000`0043e760 000007fe`f3e2702a mscorwks!MethodDesc::DoPrestub+0x116f
  00000000`0043e910 000007fe`f3f8d387 mscorwks!PreStubWorker+0x1fa
  00000000`0043e9d0 000007fe`f3f8d4a2 mscorwks!ThePreStubAMD64+0x87
  00000000`0043eaa0 000007fe`f3e66ef3 mscorwks!CallDescrWorker+0x82
  00000000`0043eaf0 000007fe`f3e56d1f mscorwks!CallDescrWorkerWithHandler+0xd3
  00000000`0043eb90 000007fe`f3ee35b7 mscorwks!MethodDesc::CallDescr+0x24f
  00000000`0043ede0 000007fe`f3eff358 mscorwks!ClassLoader::RunMain+0x22b
  00000000`0043f040 000007fe`f3ec7835 mscorwks!Assembly::ExecuteMainMethod+0xbc
  00000000`0043f330 000007fe`f3db349f mscorwks!SystemDomain::ExecuteMainMethod+0x491
  00000000`0043f900 000007fe`f3ef8ab0 mscorwks!ExecuteEXE+0x47
  00000000`0043f950 000007fe`f5195b21 mscorwks!CorExeMain+0xac
  00000000`0043f9b0 00000000`7760f56d MSCOREE!CorExeMain_Exported+0x57
  00000000`0043f9e0 00000000`77742cc1 KERNEL32!BaseThreadInitThunk+0xd
  00000000`0043fa10 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
  
     1  Id: 198c.13f8 Suspend: 1 Teb: 000007ff`fffdc000 Unfrozen
  Child-SP          RetAddr           Call Site
  00000000`020df7f8 000007fe`fd8f13a6 ntdll!NtWaitForMultipleObjects+0xa
  00000000`020df800 00000000`775ff190 KERNELBASE!WaitForMultipleObjectsEx+0xe8
  00000000`020df900 000007fe`f3f1b525 KERNEL32!WaitForMultipleObjects+0xb0
  00000000`020df990 000007fe`f3efe331 mscorwks!DebuggerRCThread::MainLoop+0xbd
  00000000`020dfa40 000007fe`f3db5caa mscorwks!DebuggerRCThread::ThreadProc+0xf9
  00000000`020dfa90 00000000`7760f56d mscorwks!DebuggerRCThread::ThreadProcStatic+0x56
  00000000`020dfae0 00000000`77742cc1 KERNEL32!BaseThreadInitThunk+0xd
  00000000`020dfb10 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
  
     2  Id: 198c.1840 Suspend: 1 Teb: 000007ff`fffda000 Unfrozen
  Child-SP          RetAddr           Call Site
  00000000`1ae1f608 000007fe`fd8f10ac ntdll!ZwWaitForSingleObject+0xa
  00000000`1ae1f610 000007fe`f3df72e2 KERNELBASE!WaitForSingleObjectEx+0x79
  00000000`1ae1f6b0 000007fe`f3df73d3 mscorwks!ZapImage::OutputDebugInfo+0xaa
  00000000`1ae1f710 000007fe`f3f0f0a9 mscorwks!CLREvent::WaitEx+0x63
  00000000`1ae1f7c0 000007fe`f3ef922a mscorwks!WKS::WaitForFinalizerEvent+0x49
  00000000`1ae1f7f0 000007fe`f3ee4ffc mscorwks!WKS::GCHeap::FinalizerThreadWorker+0x4a
  00000000`1ae1f830 000007fe`f3ea85ad mscorwks!MethodTableBuilder::AllocateFromHighFrequencyHeap+0x70
  00000000`1ae1f880 000007fe`f3ef0f2d mscorwks!List&lt;tagNgenDependents * __ptr64&gt;::AddTail+0x11d
  00000000`1ae1f950 000007fe`f3da4d1e mscorwks!ZapStubPrecode::GetType+0x39
  00000000`1ae1f990 000007fe`f3eff984 mscorwks!ManagedThreadBase_NoADTransition+0x42
  00000000`1ae1f9f0 000007fe`f3db0718 mscorwks!WKS::GCHeap::FinalizerThreadStart+0x74
  00000000`1ae1fa30 00000000`7760f56d mscorwks!Thread::intermediateThreadProc+0x78
  00000000`1ae1fb00 00000000`77742cc1 KERNEL32!BaseThreadInitThunk+0xd
  00000000`1ae1fb30 00000000`00000000 ntdll!RtlUserThreadStart+0x1d
  </code></pre>
  
  <p>Seems like when I run 'analyze', the money error file is </p>
  
  <pre><code>EXCEPTION_MESSAGE:  Could not load file or assembly 'System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a
  MANAGED_OBJECT_NAME:  System.IO.FileNotFoundException
  MANAGED_STACK_COMMAND:  !pe 24b6010
  </code></pre>
  
  <p>But I don't understand how this could be -- .NET 3.5 is installed!</p>
  
  <hr>
  
  <p><strong>I'm an idiot - I had to go enable .NET Framework 3.5.1 Features in the Features Pane of Win2008 R2 x64. I guess at least I learned a little about windbg...</strong></p>