AccessViolation Exception
AccessViolation Exception
Ok I fixed my code from the previous post and it now compiles but when I run the app I get a AccessViolation Exception stating that Irrlicht.NET.dll is trying to write to protected memory. Am I doing something wrong in my project settings or something. I am using C++/CLI and C++ Express beta 2.
How much more information can I give. I converted the .Net example Hello World to C++/CLI. It compiles and when the mesh attempts to load it craps out saying it is trying to write to protected memory. That is all the information the compiler gave me. If you really want to know, the entire project has default settings except that I added a reference to the Irrlicht.NET.dll file.
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
If Irrlicht.dll is trying to write protected memory, then my best guess would be you're doing something wrong with one of your pointers. This isn't a lot of help, can you break into the debugger and determine what line of code is causing this? Also, as Dances stated, there are not many .NET developers, I only come into this forum when I'm bored I would love to use .NET, but I know from reading in several places that some interfaces aren't supported yet or are missing functionality, so I just make do with C++ for now. Hopefully the next version will 100% .NET compatible (in a perfect world) and then I may wander over.
Using VS2005 and C# Express 2005 with irrlicht.net-0.14.0
When trying to dispose the device I get:
All drivers apart from OpenGL seem to dispose correctly. This error means that applications using OpenGL will offer to send a bug report to Microsoft every time they are run (outside Visual Studio), which is clearly not an ideal situation.
When trying to dispose the device I get:
The simplest code to reproduce the error:System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="Irrlicht.NET"
StackTrace:
at irr.IUnknown.drop(IUnknown* )
at Irrlicht.GUI.IGUIElement.Finalize()
Code: Select all
using System;
using System.Collections.Generic;
using System.Text;
using Irrlicht;
using Irrlicht.Video;
using Irrlicht.Core;
namespace TestCase
{
class Test
{
[STAThread]
public static void Main(string[] args) {
IrrlichtDevice device = new IrrlichtDevice(
DriverType.OPENGL,
new Dimension2D(1024, 768),
32,
false,
true,
true);
device.CloseDevice();
}
}
}
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1
Unfortunately, the exception is not able to be caught, I think because it is being raised after the end of the c# code by something in irrlicht destructors. I'm starting to think that it may be from the log window because when I use the following dirty hack:
... the logger window stays open, and no exception occurs. When the logger window is closed the application exits neatly. Then I realised that closing the logger window causes a neat exit without raising the exception... could the problem be caused by this window not being closed when close device is called?
Code: Select all
while (device != null)
{
device.CloseDevice();
Thread.Sleep(100);
}
-
- Posts: 370
- Joined: Mon Aug 29, 2005 10:54 pm
- Location: http://web.utk.edu/~pfox1