5System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
1
有关调用实时(JIT)调试而不是此对话框的详细信息,
2
请参见此消息的结尾。
3![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
4
************** 异常文本 **************
5
System.AccessViolationException: 尝试读取或写入受保护的内存。这通常指示其他内存已损坏。
6
在 System.Drawing.SafeNativeMethods.Gdip.GdipDrawRectangleI(HandleRef graphics, HandleRef pen, Int32 x, Int32 y, Int32 width, Int32 height)
7
在 System.Drawing.Graphics.DrawRectangle(Pen pen, Int32 x, Int32 y, Int32 width, Int32 height)
8
在 System.Drawing.Graphics.DrawRectangle(Pen pen, Rectangle rect)
9
在 System.Windows.Forms.ComboBox.FlatComboAdapter.DrawFlatCombo(ComboBox comboBox, Graphics g)
10
在 System.Windows.Forms.ComboBox.WndProc(Message& m)
11
在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
12
在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
13
在 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
14![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
15![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
16
************** 已加载的程序集 **************
17
mscorlib
18
程序集版本: 2.0.0.0
19
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
20![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
21
----------------------------------------
22
System.Windows.Forms
23
程序集版本: 2.0.0.0
24
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
25![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
26
----------------------------------------
27
System
28
程序集版本: 2.0.0.0
29
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
30![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
31
----------------------------------------
32
System.Drawing
33
程序集版本: 2.0.0.0
34
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
35![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
36
----------------------------------------
37
System.Configuration
38
程序集版本: 2.0.0.0
39
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
40![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
41
----------------------------------------
42
System.Xml
43
程序集版本: 2.0.0.0
44
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
45![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
46
----------------------------------------
47
mscorlib.resources
48
程序集版本: 2.0.0.0
49
Win32 版本: 2.0.50727.832 (QFE.050727-8300)
50![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
51
----------------------------------------
52
System.Windows.Forms.resources
53
程序集版本: 2.0.0.0
54
Win32 版本: 2.0.50727.42 (RTM.050727-4200)
55![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
基本代码: file:/**////C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHS_b77a5c561934e089/System.Windows.Forms.resources.dll
56
----------------------------------------
57![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
58
************** JIT 调试 **************
59
要启用实时(JIT)调试,
60
该应用程序或计算机的 .config 文件(machine.config)的 system.windows.forms 节中必须设置
61
jitDebugging 值。
62
编译应用程序时还必须启用
63
调试。
64![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
65
例如:
66![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
67
<configuration>
68
<system.windows.forms jitDebugging="true" />
69
</configuration>
70![](https://www.cnblogs.com/Images/OutliningIndicators/None.gif)
71
启用 JIT 调试后,任何无法处理的异常
72
都将被发送到在此计算机上注册的 JIT 调试器,
73
而不是由此对话框处理。
原文地址:https://www.cnblogs.com/hyruur/p/1213702.html