Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Bug #457: 6.5 (C#): AccessViolationException in TVAI()
Product:
TV3D SDK 6.5
Language:
C#
Current State:
Closed
Resolution:
Fixed
Created On:
July 20th, 2005
Last Modified:
July 23rd, 2005
Reported By:
Omnigames
code:
private TVAI AI = new TVAI();

error message:
System.AccessViolationException was unhandled
Message="Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
Source="MTV3D65"
StackTrace:
at CTVAI.__ctor(CTVAI* )
at MTV3D65.TVAI..ctor()
at MyGame.GRAPHICS.Initialize() in C:\Work\MyGame\MyGame\Graphics.cs:line 51
at MyGame.WorldSceneForm..ctor() in C:\Work\MyGame\MyGame\WorldSceneForm.cs:line 18
at MyGame.Program.Main() in C:\Work\MyGame\MyGame\Program.cs:line 16
at System.AppDomain.nExecuteAssembly(Assembly assembly, String args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

system info:
MS Windows XP Pro 2002
Service Pack 2
Intel CPU 1.59Ghz, 448mb RAM
Visual Studio 2005 Beta 2
MTV3D65 (6.5 - 07/14/2005 - 14:25 GMT +1)
DirectX 9 SDK (June 2005)

Comments:

Posted by SylvainTV on July 23rd, 2005 at 4:40 PM
Yes, it's probably because you're "newing" it before the engine is initialized.

All collections and arrays are initialized when you call an TV3D.Initialize function, and the constructors of TVAI makes an access to these things, so it's crashing if the engine isn't initialized.

However a crash is not good, so i will add some test to avoid the crash :)

But yea i think the best would be to have Scene.CreateAI and Scene.CreateLandscape just like the rest...