Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 Winform 应用程序 (C#),它从 dll 导入一些函数。
有时在运行应用程序时,我会遇到以下异常:
System.AccessViolationException:试图读取或写入受保护的内存。这通常表明其他内存已损坏。
我在 AppDomain.CurrentDomain.UnhandledException 中捕获它。
但我看不到堆栈。我如何获得堆栈?
谢谢。
此异常发生在 CLR 的互操作管道中的程序范围之外,并且只能通过将外部调试器附加到进程来捕获。我建议使用 WinDbg(Windows 调试工具)。
-Oisin