本文介绍了System.AccessViolationException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 当我尝试访问Frotran dll时,我收到此异常。这里 是示例代码。 使用System; 使用System.Collections.Generic; 使用System.Text; 使用System.Runtime.InteropServices; 名称空间TestApplicationFracEngine { class InterfaceClass { [DllImport(" fortran.dll",EntryPoint =" FR_MAIN_DLL", CallingConvention = CallingConvention.StdCall) ] public static extern void FR_MAIN_DLL(int errorNumber,string errorMessage,int length); public void CallFortran() { FR_MAIN_DLL(1,",120); } } } } 我已经复制了调试目录中的所有相关dll。当我运行 这个程序时,我得到以下异常,我无法摆脱它。 发生类型''System.AccessViolationException'的未处理异常在 TestApplicationFracEngine.exe 附加信息:尝试读取或写入受保护的内存。这是 经常表明其他内存已损坏。 请帮助我解决这个问题。Hi,I am getting this exceptions when I am trying to access the Frotran dll. Hereis sample code for that.using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;namespace TestApplicationFracEngine{class InterfaceClass{[DllImport("fortran.dll", EntryPoint = "FR_MAIN_DLL",CallingConvention = CallingConvention.StdCall)]public static extern void FR_MAIN_DLL(int errorNumber, stringerrorMessage, int length);public void CallFortran(){FR_MAIN_DLL(1, "", 120);}}}}I have copied the all the dependent dlls in the debug directory. When I runthis program I am getting the following exception which I couldn''t get rid of.An unhandled exception of type ''System.AccessViolationException'' occurred inTestApplicationFracEngine.exeAdditional information: Attempted to read or write protected memory. This isoften an indication that other memory is corrupt.Please help me out in solving this issue.推荐答案 [引用文字剪辑 - 35行][quoted text clipped - 35 lines] - 通过 http://www.dotnetmonster.com--Message posted via http://www.dotnetmonster.com [引用文字剪辑 - 35行][quoted text clipped - 35 lines] - 通过 http://www.dotnetmonster.com 这篇关于System.AccessViolationException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-28 06:48