-
August 3rd, 2010, 04:49 PM
#1
[RESOLVED] mscorlib AccessViolationException
I add a class to my native dll and compile it with /Clr which I am referencing in a VB.Net client. When I debug the main form's sub new() my Dll is calling several (static) functions successfully. This tells me the delayed load of the managed class works. After every line in the new operator the file I get an unhandled "System.AccessViolationException" indicating something is not allocated. Trying to break at this point only gives me "No symbols are loaded for any call stack frame".
When I try to run the app normally the following log is produced by JIT.
The last module loaded is mscorlib, which I think is noteworthy. My dll is "Toolkit1". I am not compiling dllmain with managed code, I am fairly positive. I could be wrong... does anyone have any clues as to what I am doing wrong?
Thanks in advanced and sorry I dont have more details.
************** Exception Text **************
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Web_Scan.fMain.fMain_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
eBridgeWebScan
Assembly Version: 4.1.0.200
Win32 Version: 4.1.0.200
CodeBase: file:///C:/Users/tfobear/Desktop/scan%20app/eBridge%20Web%20Scan.NET/bin/Debug/eBridgeWebScan.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.4927 (NetFXspW7.050727-4900)
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
Toolkit1
Assembly Version: 0.0.0.0
Win32 Version:
CodeBase: file:///C:/Users/Foo/Desktop/scan%20app/%20Web%20Scan.NET/bin/Debug/Toolkit1.DLL
----------------------------------------
msvcm90
Assembly Version: 9.0.30729.4974
Win32 Version: 9.00.30729.4974
CodeBase: file:///C:/Windows/WinSxS/x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4974_none_50940634bcb759cb/msvcm90.dll
----------------------------------------
PegasusImaging.WinForms.BarcodeXpress5
Assembly Version: 5.0.19.0
Win32 Version: 5.0.19.0
CodeBase: file:///C:/Users/Foo/Desktop/scan%20app/%20Web%20Scan.NET/bin/Debug/PegasusImaging.WinForms.BarcodeXpress5.DLL
----------------------------------------
-
August 4th, 2010, 08:57 AM
#2
Debug Dll
*EDIT* You can ignore this post, I forgot I added /NOENTRY because I believed you couldnt have an native entry point in a managed dll, I didnt know what I was doing!
I still have problems though, after my main forms New operator, a System.OutOfMemoryException is thrown. My computer is definately NOT out of memory. The debugger says no public symbols found so I can not trace the stack. GAH
I was not using a debug version of the Dll for the above post. I think I heard from someone the Debug CRT has issues with the CLI...
anyways i think that mscorlib clue can be expanded on in this problem. With a Debug version of the Dll, and "Debug unmanaged code" turned on in my VB.Net project I get more details.
Code:
struct OcrJob
{
TOCRRESULTS * pTocrResults;
char * pzChars;
int nChars;
long lOrient;
long RegNo[2];
};
typedef map<DWORD, OcrJob *> OcrMapMT;
typedef pair<DWORD, OcrJob *> OcrPair;
static OcrMapMT g_ocrMap; // Debugger breaks here
static OcrMutex g_mutex;
could it be an issue with the fact that I am trying to declare a static STL type?
Last edited by TFobear; August 4th, 2010 at 10:02 AM.
-
August 12th, 2010, 01:38 AM
#3
Re: [RESOLVED] mscorlib AccessViolationException
hi,
I believed you couldnt have an native entry point in a managed dll, I didnt know what I was doing
regards,
phe9oxis,
http://www.guidebuddha.com
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|