首页 新闻 会员 周边

System.AccessViolationException: 嘗試讀取或寫入受保護的記憶體

0
悬赏园豆:50 [已解决问题] 解决于 2013-05-13 11:58

二次开发身份证阅读器,出现这个问题。程序在我的电脑上运行是可以的在其他电脑运行均出现这个问题。

网上上要修改DLL为Static,可是DLL是直接调用的,怎么去修改?

还有在我电脑上为什么可以,而在其他电脑就不行了?

如需叫用 Just-In-Time (JIT) 偵錯的詳細資料,
請參閱本訊息結尾處 (而非這個對話方塊) 的資訊。

************** 例外狀況文字 **************
System.AccessViolationException: 嘗試讀取或寫入受保護的記憶體。這通常表示其他記憶體已損毀。
   於 WindowsFormsApplication1.Form1.Syn_ReadMsg(Int32 iPortID, Int32 iIfOpen, IDCardData& pIDCardData)
   於 WindowsFormsApplication1.Form1.button17_Click(Object sender, EventArgs e) 於 D:\SynIDCardAPI\SynIDCardAPI\测试程序\C#\WindowsFormsApplication1\WindowsFormsApplication1\Form1.cs: 行 410
   於 System.Windows.Forms.Control.OnClick(EventArgs e)
   於 System.Windows.Forms.Button.OnClick(EventArgs e)
   於 System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
   於 System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   於 System.Windows.Forms.Control.WndProc(Message& m)
   於 System.Windows.Forms.ButtonBase.WndProc(Message& m)
   於 System.Windows.Forms.Button.WndProc(Message& m)
   於 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   於 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   於 System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** 已載入的組件 **************
mscorlib
    組件版本: 2.0.0.0
    Win32 版本: 2.0.50727.5466 (Win7SP1GDR.050727-5400)
    程式碼基底: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
WindowsFormsApplication1
    組件版本: 1.0.0.0
    Win32 版本: 1.0.0.0
    程式碼基底: file:///C:/Users/admin_leon/Desktop/Release/WindowsFormsApplication1.exe
----------------------------------------
System.Windows.Forms
    組件版本: 2.0.0.0
    Win32 版本: 2.0.50727.5468 (Win7SP1GDR.050727-5400)
    程式碼基底: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    組件版本: 2.0.0.0
    Win32 版本: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    程式碼基底: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    組件版本: 2.0.0.0
    Win32 版本: 2.0.50727.5467 (Win7SP1GDR.050727-5400)
    程式碼基底: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
mscorlib.resources
    組件版本: 2.0.0.0
    Win32 版本: 2.0.50727.5466 (Win7SP1GDR.050727-5400)
    程式碼基底: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
System.Windows.Forms.resources
    組件版本: 2.0.0.0
    Win32 版本: 2.0.50727.5420 (Win7SP1.050727-5400)
    程式碼基底: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_zh-CHT_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** JIT 偵錯 **************
若要啟用 Just-In-Time (JIT) 偵錯功能,則必須在
此應用程式或電腦的 .config 檔案中,設定
system.windows.forms 區段內的 jitDebugging 值。
且該應用程式也必須在啟用偵錯的狀態下進行
編譯。

例如:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

當 JIT 偵錯功能啟用後,會將所有未處理的例外
狀況傳送給電腦上已註冊的 JIT 偵錯工具進行處
理,而不是使用這個對話方塊來處理。
sirili的主页 sirili | 初学一级 | 园豆:44
提问于:2013-05-10 20:12
< >
分享
最佳答案
0

mscorlib
    組件版本: 2.0.0.0
    Win32 版本:
2.0.50727.5466 (Win7SP1GDR.050727-5400)
    程式碼基底: file:
///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
安裝.net FromWork Compact SP2后解決

sirili | 初学一级 |园豆:44 | 2013-05-13 11:04
其他回答(1)
0
收获园豆:50
@@@一统@@@ | 园豆:1551 (小虾三级) | 2013-05-11 10:30
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册