我正在尝试找出令人讨厌的 AccessViolation 的原因。此访问冲突始终发生在相同的堆栈跟踪中。
(c18.b2c): Access violation - code c0000005 (!!! second chance !!!) *** ERROR: Symbol file could not be found. Defaulted to export symbols for C:\Windows\Microsoft.NET\Framework64\v4.0.30319\clr.dll - clr!StrongNameSignatureVerification+0x797c: 000007fe
f70eaa4c 48894110 mov qword ptr [rcx+10h],rax ds:00000000
00000010=????????????????
访问冲突在“AwareLock::OwnedByCurrentThread”中的某处抛出 加载正确的符号后,我得到了这个堆栈跟踪:
clr!ObjHeader::Wait+0x24, calling clr!AwareLock::OwnedByCurrentThread clr!ObjectNative::WaitTimeout+0xc7, calling clr!ObjHeader::Wait System.Threading.Monitor.Wait(System.Object, System.TimeSpan)), calling 000007fef70ea670 (stub for System.Threading.Monitor.ObjWait(Boolean, Int32, System.Object)) 0000000034cae6a8 000007fef70ea6eb clr!ObjectNative::WaitTimeout+0x7b, calling clr!LazyMachStateCaptureState 0000000034cae6f0 000007fef5712f7f (MethodDesc 000007fef4b28d08 +0x4f System.Threading.Monitor.Wait(System.Object, System.TimeSpan)), calling 000007fef70ea670 (stub for System.Threading.Monitor.ObjWait(Boolean, Int32, System.Object)) 0000000034cae740 000007fe986debe1 (MethodDesc 000007fe98789088 +0xc1 PeripheralHardwareAccess.PeripheralHardwareAccessBase.WaitForAck(PeripheralHardwareAccess.AsciiControlProtocolMessage, System.TimeSpan)), calling (MethodDesc 000007fef4b28d08 +0 System.Threading.Monitor.Wait(System.Object, System.TimeSpan))
因为我们使用 native 代码,所以锁定对象的对象 header 可能已损坏。我已经使用提到的“gflags.exe”启用了堆检查 here没有成功。
而且我运行了 SOS 的“!VerifyHeap”命令,没有检测到任何错误。如果始终是同一个对象则无效。有没有办法在运行时进行检查? 您是否有其他想法到底是什么损坏了以及我如何检测到此异常的原因?或者哪些命令/数据可能有助于调查此错误。
谢谢
曼纽尔
最佳答案
不知道是不是同样的问题。我只记得这是一个 000005 访问 Vialotion 异常。但由于到目前为止还没有人回答,以下可能会有所帮助。我们在使用 .NET 4.0 的 AutoCAD 中遇到了类似的问题。安装 .NET 4.5 后,我们在一段时间后遇到了访问冲突异常。但是当它发生一次时,它总是出现。 卸载 4.5 并安装 4.0 解决了它。背后的原因是在 AutoCAD 代码中触发的托管 C++ v16 编译器中的错误。
https://connect.microsoft.com/VisualStudio/feedback/details/801715/clr-runtime-error-kb2640103
希望对你有帮助
关于c# - CLR AwareLock::OwnedByCurrentThread 中的访问冲突,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22692492/