C# 调用root.Shutdown()后的Axiom framework NullReferenceException
所以我编写了自己的游戏类,初始化方式如下(顺便说一句,这是F而不是C):C# 调用root.Shutdown()后的Axiom framework NullReferenceException,c#,.net,f#,ogre,C#,.net,F#,Ogre,所以我编写了自己的游戏类,初始化方式如下(顺便说一句,这是F而不是C): root是构造函数中的第一个参数,因此它与第一个示例中的engine是同一个对象。以下是全部错误: System.NullReferenceException was unhandled HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=Axiom StackTrace:
root
是构造函数中的第一个参数,因此它与第一个示例中的engine
是同一个对象。以下是全部错误:
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Axiom
StackTrace:
at Axiom.Graphics.RenderTarget.Update(Boolean swapBuffers)
at Axiom.Graphics.RenderSystem.UpdateAllRenderTargets(Boolean swapBuffers)
at Axiom.Core.Root.UpdateAllRenderTargets()
at Axiom.Core.Root.RenderOneFrame()
at Axiom.Core.Root.StartRendering()
at MiningGameTest.Game.RunGame() in H:\Projects\FSharp\MiningGameTest\MiningGameTest\Game.fs:line 22
at MiningGameTest.Host.Axiom.Program.Main(String[] args) in h:\Projects\FSharp\MiningGameTest\MiningGameTest.Host.Axiom\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
内部异常:
还有一件事:我不确定这是否与此有关,但在项目启动时,我也立即收到了以下错误:
A first chance exception of type 'System.DllNotFoundException' occurred in FreeImageNET.dll
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
A first chance exception of type 'System.TypeInitializationException' occurred in OpenTK.dll
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
A first chance exception of type 'System.NullReferenceException' occurred in Axiom.dll
我是做错了什么,还是这是一个公理错误
PS:我在Windows 8和Visual Studio 2012 Professional下运行,使用OpenGL渲染系统。你说“root”是构造函数的第一个参数-我们可以看到这种情况下的代码吗?它看起来是这样的:
类型游戏(root:root,window:window)=……
另外,请记住这是具有“default”的F#像上面这样的构造函数。它与C#有点不同,但它几乎只是一个构造函数,具有自动字段绑定到参数的功能。它们在您不需要任何特殊代码时使用。
System.NullReferenceException was unhandled
HResult=-2147467261
Message=Object reference not set to an instance of an object.
Source=Axiom
StackTrace:
at Axiom.Graphics.RenderTarget.Update(Boolean swapBuffers)
at Axiom.Graphics.RenderSystem.UpdateAllRenderTargets(Boolean swapBuffers)
at Axiom.Core.Root.UpdateAllRenderTargets()
at Axiom.Core.Root.RenderOneFrame()
at Axiom.Core.Root.StartRendering()
at MiningGameTest.Game.RunGame() in H:\Projects\FSharp\MiningGameTest\MiningGameTest\Game.fs:line 22
at MiningGameTest.Host.Axiom.Program.Main(String[] args) in h:\Projects\FSharp\MiningGameTest\MiningGameTest.Host.Axiom\Program.cs:line 14
at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
A first chance exception of type 'System.DllNotFoundException' occurred in FreeImageNET.dll
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
A first chance exception of type 'System.TypeInitializationException' occurred in OpenTK.dll
A first chance exception of type 'System.DllNotFoundException' occurred in OpenTK.dll
A first chance exception of type 'System.NullReferenceException' occurred in Axiom.dll