WarehouseJim
22-04-2010 14:04:03
To summarise an issue I first raised on the Mogre 1.6.5 discussion:
This is similar to the suggestion about how to catch exceptions in Tutorial 0, however, it doesn't catch my exception which can be recreated (good enough) by changing the name of C:\MogreSDK\Media\packs (assuming you use a zip from within it).
So I did some digging around and http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.sehexception.aspx suggests that actually what would have been a SEHException is often actually re-mapped to a number of different exceptions, including AccessViolationException. If I catch the AccessViolationException, then I can view the Ogre exception using the above code.
Am I doing something different, or should the advice be changed to catch all the exceptions in the link (OutOfMemoryException, AccessViolationException, [NullReferenceException]) explicitly? If it makes any difference, I'm using .NET 3.5 & C# 3.0.
As a more general criticism, I find with my projects that it's a nightmare to work out why Mogre isn't working, with cryptic / misleading exception messages e.g. "Attempted to read or write protected memory. This is often an indication that other memory is corrupt." More usefully in ogre.log it says: "14:29:01: OGRE EXCEPTION(7:InternalErrorException): C:/MogreSDK/Media/packs/OgreCore.zip - error whilst opening archive: Unable to read zip file. in ZipArchive::checkZzipError at ..\src\OgreZip.cpp (line 259)"
That's because you're swallowing SEHExceptions somewhere, like:
try
{
MyApp app = new MyApp ();
}
catch (System.Runtime.InteropServices.SEHException)
{
if (OgreException.LastException != null)
LogManager.Singleton.LogMessage(OgreException.LastException.FullDescription);
else
throw;
}
The AccessViolationException is only a followup.
This is similar to the suggestion about how to catch exceptions in Tutorial 0, however, it doesn't catch my exception which can be recreated (good enough) by changing the name of C:\MogreSDK\Media\packs (assuming you use a zip from within it).
So I did some digging around and http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.sehexception.aspx suggests that actually what would have been a SEHException is often actually re-mapped to a number of different exceptions, including AccessViolationException. If I catch the AccessViolationException, then I can view the Ogre exception using the above code.
Am I doing something different, or should the advice be changed to catch all the exceptions in the link (OutOfMemoryException, AccessViolationException, [NullReferenceException]) explicitly? If it makes any difference, I'm using .NET 3.5 & C# 3.0.