ImGuiNET / ImGui.NET

An ImGui wrapper for .NET.
MIT License
1.87k stars 304 forks source link

Example issue. System.ArgumentNullException: Array cannot be null. (Parameter 'chars') #415

Closed Walkplay closed 1 year ago

Walkplay commented 1 year ago

This issue already has pull request created: https://github.com/ImGuiNET/ImGui.NET/pull/414

Unhandled exception. System.ArgumentNullException: Array cannot be null. (Parameter 'chars')
   at System.Text.UTF8Encoding.GetBytes(Char* chars, Int32 charCount, Byte* bytes, Int32 byteCount)
   at ImGuiNET.Util.GetUtf8(ReadOnlySpan`1 s, Byte* utf8Bytes, Int32 utf8ByteCount)
   at ImGuiNET.ImGui.SliderFloat(ReadOnlySpan`1 label, Single& v, Single v_min, Single v_max, ReadOnlySpan`1 format)
   at GUI.SampleGame.ImGuiLayout() in D:\Repos\tile-editor\GUI\SampleGame.cs:line 86
   at GUI.SampleGame.Draw(GameTime gameTime) in D:\Repos\tile-editor\GUI\SampleGame.cs:line 64
   at Microsoft.Xna.Framework.Game.DoDraw(GameTime gameTime)
   at Microsoft.Xna.Framework.Game.Tick()
   at Microsoft.Xna.Framework.SdlGamePlatform.RunLoop()
   at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
   at Microsoft.Xna.Framework.Game.Run()
   at GUI.Program.Main(String[] args) in D:\Repos\tile-editor\GUI\Program.cs:line 7

Change this line SampleGame.cs:line 86

Old: ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, string.Empty); New: ImGui.SliderFloat("float", ref f, 0.0f, 1.0f, " ");

zaafar commented 1 year ago

I am going to release a new version of imgui.net today that will fix this issue.