在Windows Server 2008 R2上运行c#app时出现KERNELBASE.dll错误?

时间:2011-06-27 20:40:48

标签: c# dllimport windows-server-2008-r2

我有一个.NET 3.5可执行文件,使用'Any CPU'编译,当我尝试在Windows Server 2008 x64 R2上运行它时 - 它给了我:

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

还有其他人遇到/解决了这个问题吗?

我怀疑DLLImports是它甚至没有使它成为main() - 我还应该补充一点,这适用于非R2 Win Server 2008 x64

编辑:没关系 - dll导入似乎不是导致问题的原因 - 我评论了它并试了一下,发生了同样的行为。 重命名问题。

EDIT II :这个内核基础DLL错误似乎相当普遍,但我找不到任何理由。

每个请求完成错误:

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

我无法及时附加调试器,无法在错误机器上安装VS: - (

这是windbg输出,我担心这对我来说只是胡言乱语......我不知道是否有人能理解它。

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> 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

更多信息:

0:000> |* ~* 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<tagNgenDependents * __ptr64>::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

似乎在我运行'analyze'时,钱错误文件是

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

但我不明白这是怎么回事 - 安装了.NET 3.5!


我是个白痴 - 我必须在Win2008 R2 x64的功能窗格中启用.NET Framework 3.5.1功能。我想至少我对windbg有所了解......

2 个答案:

答案 0 :(得分:6)

异常0xE0434F4D是未处理的CLR异常。很可能KERNELBASE的东西只是用于引发异常的库函数 - RtlRaiseException或类似的。您需要在CLR代码中捕获异常,创建故障转储或附加调试器(例如windbg)以获取详细信息,例如堆栈跟踪。 This MSDN blog post有一个使用windbg来诊断CLR崩溃的例子。

答案 1 :(得分:3)

我刚刚在我创建的Windows窗体App中遇到过此问题。显然,有很多问题可能导致这种情况。在我的情况下,您可以打开任务管理器,单击应用程序,在任务管理器中看到它打开,然后立即关闭。查看问题的唯一方法是查看事件查看器并找到错误。

我有一个在Program.cs的构造函数中运行的方法,这是在启动Windows窗体应用程序时首先实例化的。我在代码中遇到了一个错误,在创建任何异常处理之前导致异常。为了解决这个问题,我在创建一个未处理的异常方法之后将代码移动到了一个点:

AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

在我的表单构造函数中。现在程序将启动并实际抛出错误。然后,我只需要修复代码中的错误。

我希望这可以帮助你或其他任何人。