You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug DebugText.Print("something", new Int2(20, 20)) from a script causes a Null Reference Exception in DebugTextSystem line 88. It looks like DebugTextSystem.Content is initialized to null since the DebugTextSystem is created and registered in the Game constructor, while the ContentManager is created and registered later in GameBase.PrepareContext().
To Reproduce
Steps to reproduce the behavior:
Create a basic Game
In the BasicCamerController.Update method, add this line: DebugText.Print("Hello, Crash", new Int2(20, 20));
Get the below exception/crash:
Expected behavior
Debug Text
Screenshots
If applicable, add screenshots to help explain your problem (use GitHub drag & drop)
Log and callstacks
[Game]: Error: Unexpected exception. System.NullReferenceException: Object reference not set to an instance of an object.
at Xenko.Profiling.DebugTextSystem.Draw(GameTime gameTime)
at Xenko.Games.GameSystemCollection.Draw(GameTime gameTime)
at Xenko.Games.GameBase.Draw(GameTime gameTime)
at Xenko.Games.GameBase.DrawFrame()
at Xenko.Games.GameBase.TickInternal()
System.NullReferenceException: Object reference not set to an instance of an object.
at Xenko.Profiling.DebugTextSystem.Draw(GameTime gameTime)
at Xenko.Games.GameSystemCollection.Draw(GameTime gameTime)
at Xenko.Games.GameBase.Draw(GameTime gameTime)
at Xenko.Games.GameBase.DrawFrame()
at Xenko.Games.GameBase.TickInternal()
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at Xenko.Profiling.DebugTextSystem.Draw(GameTime gameTime)
at Xenko.Games.GameSystemCollection.Draw(GameTime gameTime)
at Xenko.Games.GameBase.Draw(GameTime gameTime)
at Xenko.Games.GameBase.DrawFrame()
at Xenko.Games.GameBase.TickInternal()
at Xenko.Games.GameBase.Tick()
at Xenko.Games.GamePlatform.Tick()
at Xenko.Games.GamePlatform.OnRunCallback()
at Xenko.Games.GameWindowWinforms.<>c__DisplayClass19_0.<Run>b__0()
at Xenko.Games.WindowsMessageLoop.Run(Control form, RenderCallback renderCallback, Boolean useApplicationDoEvents)
at Xenko.Games.GameWindowWinforms.Run()
at Xenko.Games.GamePlatform.Run(GameContext gameContext)
at Xenko.Games.GameBase.Run(GameContext gameContext)
at DebugTextTest.DebugTextTestApp.Main(String[] args) in C:\code\misc\DebugTextTest\DebugTextTest\DebugTextTest.Windows\DebugTextTestApp.cs:line 11
Additional context
I can hack around the bug if I change DebugTextSystem line 88 to:
Release Type: GitHub
Version: master
Platform(s): Windows/(All I think?)
Describe the bug
DebugText.Print("something", new Int2(20, 20))
from a script causes a Null Reference Exception in DebugTextSystem line 88. It looks likeDebugTextSystem.Content
is initialized to null since the DebugTextSystem is created and registered in theGame
constructor, while theContentManager
is created and registered later inGameBase.PrepareContext()
.To Reproduce
Steps to reproduce the behavior:
DebugText.Print("Hello, Crash", new Int2(20, 20));
Expected behavior
Debug Text
Screenshots
If applicable, add screenshots to help explain your problem (use GitHub drag & drop)
Log and callstacks
Additional context
I can hack around the bug if I change DebugTextSystem line 88 to:
I can create a pull request for that workaround with a comment about it being a workaround if that's worth doing.
The text was updated successfully, but these errors were encountered: