TypeInitializationException
I'm a newb to the whole .NET thing, so I'm not going to say that I'm an expert or anything...
I don't own VS2003, but I do have the 2k5 betas, and so I downloaded the Ogre 1.0.4 2003 SDK, and extracted the pre-built OgreDotNet Binaries into the /Debug/Bin directory of Ogre
I've gone through the basic tutorials in C++ on a linux machine, but the .NET stuff on this windows computer is giving me the following exception:
TypeInitializationException
for the following line in VB or in C# (doesn't matter)
mRoot = New Root 'VB
mRoot = New Root(); //C#
Is this due to an issue with the way I installed? Or is more information required, (like OgreSDK is D:/OgreSDK)
Any help would be much appreciated.
Thanks.
[EDIT]
just for reference, here is the C# code I tried:
///////////////////////
using System;
using System.Collections.Generic;
using System.Text;
using OgreDotNet;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
Root mRoot = new Root();
}
}
}
[/EDIT]
thelsdj
26-10-2005 06:13:50
Can you give the full exception message? and are you running this from inside the C:\OgreSDK\bin\debug directory?
I have it set to build the executable and place it in bin\debug
Also tried setting the working directory to bin\debug
System.TypeInitializationException was unhandled
Message="The type initializer for 'OgreDotNet.OgreBindingsPINVOKE' threw an exception."
Source="OgreDotNet"
TypeName="OgreDotNet.OgreBindingsPINVOKE"
StackTrace:
at OgreDotNet.OgreBindingsPINVOKE.new_Root__SWIG_2(String jarg1)
at OgreDotNet.Root..ctor(String pluginFileName)
at ConsoleApplication1.Program.Main(String[] args) in G:\Documents and Settings\Matthew Hughes\Local Settings\Application Data\Temporary Projects\ConsoleApplication1\Program.cs:line 11
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()
thelsdj
26-10-2005 06:42:09
Are you triple sure that all the OgreDotNet AND Ogre dll files are all in the same directory? also is an ogre.log file created? (if so, any error in there?)
Actually, I am sure... (I can attach a directory listing if you really would like to see all that is sitting in there... including debug executables from VS2005)
But what is strange is that the Inner Exception states that OgreBindings cannot be found.
{"Unable to load DLL 'OgreBindings': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"}
no log files... I'm not passing any log.txt string to the constructor of Root either.
Why would it not be able to find OgreBindings?
mamba
26-10-2005 19:25:54
Is there someone who compiled all stuff with VS2005
that works with an example demo?
I got only the prebuild stuff running.
M
Does it matter if I'm using VS2k5? Or should I be using .NET Framework SDK 2003 with #Develop?
I just wanted a nice IDE...
mamba
28-10-2005 05:33:56
This error I'll get with VS2005
3 memory leaks found:
Alloc. Addr Size Addr Size BreakOn BreakOn
Number Reported Reported Actual Actual Unused Method Dealloc Realloc Allocated by
------ ---------- ---------- ---------- ---------- ---------- -------- ------- ------- ---------------------------------------------------
000006 0x033EEFB8 0x00000164 0x033EEFA8 0x00000184 0x00000000 new N N OgreBindings_wrap.cxx(29434) CSharp_new_Root__SWIG_0
000007 0x033EF168 0x00000014 0x033EF158 0x00000034 0x00000000 new N N ??(0) ??
000008 0x033EF1C8 0x00000014 0x033EF1B8 0x00000034 0x00000000 new N N ??(0) ??
any help?
SIberwulf
28-10-2005 13:49:05
One thing that hung me up....
Make sure you set the output path to your project (your exe) to the SDK directory as well. I know when you add the refrences to the project in VS.NET, it will copy them locally, and when you run, it will use those instead of the original ones (that you had copied to your SDK folder).
When you set your output directory to your SDK, it will actually use the DLLs in that folder.
Yes, if you look at my previous posts, you will see that I set my output path to the ..\bin\debug directory.
I'm just getting this funky exception where it cannot find OgreBindings.dll
mamba
28-10-2005 20:07:50
I'm just getting this funky exception where it cannot find OgreBindings.dll
This occurs for me when I compile the c++ stuff without
C++ CommandLine Option: /EHsc
for OgreBindings. I don't know what it is for. But VS
suggested me to do that.
Also some Path setting were wrong.
After that I took a project that worked with the prebuilt dlls
and replaced them with the new dll's compiled with VS2005.
But now I get only an exception in debug mode. But it is
crashing completely that I loose the debug mode.
For the only error see last message.
M
I was just using the prebuilt OgreNet files available in the forum. (Debug.zip)
And it gave me these errors, I was considering building it... I just got my order for VS 2003 today (its cheaper than buying all of the 2005 express editions when they come out)
Maybe I'll install and see what that's like. Or maybe I'll see how much work it would be to SWIG Yake. I dunno... I'm just one of those bored college-students who have nothing better to do.
Well, I went ahead and installed the full VS2003 and afterwords, it demanded that I performa windows update. I had auto-update enabled, but some .NET things showed up anyways (I suppose auto-update doesn't care about .net?)
And after installing VS and peforming the updates, everything works again.
I'm going to try performing some updates on my test box which only has the free sdk's on it, and see if I can get similar results.
But from the looks of it, I solved my own problem.
Gadfly
30-04-2006 10:00:36
Im having the exact same problem with 2005 Express. Get following exception when i try to instantiate Ogre::Root
System.TypeInitializationException was unhandled
Message="The type initializer for 'OgreDotNet.OgreBindingsPINVOKE' threw an exception."
Source="OgreDotNet"
TypeName="OgreDotNet.OgreBindingsPINVOKE"
StackTrace:
at OgreDotNet.OgreBindingsPINVOKE.new_Root__SWIG_3()
at OgreDotNet.Root..ctor()
at OgreDotNetTutorial.HelloWorldApp..ctor() in C:\Work\OgreDotNetTest01\OgreDotNetTest01\Class1.cs:line 26
at OgreDotNetTutorial.HelloWorldApp.Main(String[] args) in C:\Work\OgreDotNetTest01\OgreDotNetTest01\Class1.cs:line 153
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()
I have tried with home-build dlls and the pre-build by EagleEye
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=907 - but no difference.
Is this really a 2003 - 2005 issue or am i mission something ?
DigitalCyborg
30-04-2006 19:31:17
I think that one happens when you don't have the Ogre & OgreDotNet dlls in bin/Debug & bin/Release