AccessViolation Exception

Irrlicht.Net is no longer developed or supported, Irrlicht.Net Cross Platform is a much more complete wrapper. Please ask your C# related questions on their forums first.
blewisjr

AccessViolation Exception

Post by blewisjr »

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.
blewisjr

Post by blewisjr »

I guess no one answers serious questions in this forum. Great suppor Irricht *claps*
Dances
Posts: 454
Joined: Sat Jul 02, 2005 1:45 am
Location: Canada
Contact:

Post by Dances »

What do you expect with one person programming and not many .NET developers?
Foole
Posts: 87
Joined: Mon Aug 29, 2005 10:08 am

Post by Foole »

Basd on the very little information you've provided, I would guess that you are doing something wrong. Happy now?
blewisjr

Post by blewisjr »

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.
Mr. XYZ

Post by Mr. XYZ »

Is the Irrlicht.dll in the same folder???
blewisjr

Post by blewisjr »

Yes it is. Both dll's are in the folder. Like I said the code compiles but .Net is complaining it is trying to write to protected memory.
Silicon
Posts: 2
Joined: Sun Oct 02, 2005 7:02 pm
Location: Colorado, USA

Post by Silicon »

I posted a similar thread with more info on my interactions resulting in the AccessViolation -- it only occurs when Irrlicht is run with OpenGL. I am running under .NET 2.0 (C# Express, with the July CTP of the framework). Are these also the case with your project?
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

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.
Guest

Post by Guest »

Using VS2005 and C# Express 2005 with irrlicht.net-0.14.0

When trying to dispose the device I get:
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()
The simplest code to reproduce the error:

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();
        }
    }
}
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.
kable
Posts: 3
Joined: Thu Dec 08, 2005 7:49 pm

Post by kable »

Session timed out :(

If you want any clarification to my test case post, contact me
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

Can you try catching that exception and ignoring it? Not an ideal solution, but then neither is sending a bug report all the time. I wonder why guest's code crashes (is that you kable?). I'll try reproducing the problem in C++ to see what happens (I think it should work though).
kable
Posts: 3
Joined: Thu Dec 08, 2005 7:49 pm

Post by kable »

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:

Code: Select all

            while (device != null)
            {
                device.CloseDevice();
                Thread.Sleep(100); 
            }

... 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?
pfo
Posts: 370
Joined: Mon Aug 29, 2005 10:54 pm
Location: http://web.utk.edu/~pfox1

Post by pfo »

It works fine in C++, it must be some obscure bug. Very strange. I've had the console logger window open before in the background of an app before with no problems, maybe this is a problem with .NET?
NewYoda
Posts: 4
Joined: Sat Sep 17, 2005 11:28 am
Location: Thüringen

Post by NewYoda »

I get the same AccessViolation while exiting (OPENGL) or while calling SceneManager.DrawAll (SOFTWARE2). If I use DirectX 8/9 or Software, I don't get the exception .........
Locked