Alright.. this is a weird and random one.
I Have a DebugComponent i create in a Custom MapInstance that puts it onto objects that i haven't implemented yet
The map was made a year ago and has Entities that don't exist anymore.
I put the Component onto it during the OnCreateObject Method and it consists of a single DrawGizmos() override
Sometimes when i open the project up it just causes an exception and spams the console full of errors until i restart.
Log and Stacktrace is in Media/Files
here is how i do it
----inside of the OnCreateObject function------------------------
if ( kv.TypeName.StartsWith( "wg_" ) && !handledTypes.Contains( kv.TypeName ) )
{
Log.Info( $"Object type not found for {kv.TypeName}" );
var obj = go.Components.Create<MapLoaderDebugShow>();
obj.object_type = kv.TypeName;
return;
}
---------------------------------------------------------------------
public class MapLoaderDebugShow : Component
{
float rot;
public string object_type { get; set; }
protected override void DrawGizmos()
{
base.DrawGizmos();
rot += Time.Delta * 20;
if ( rot > 360 )
rot = 0;
using ( Gizmo.Scope( "debugText" ) )
{
Gizmo.Draw.WorldText( $"{object_type} ISN'T IMPLEMENTED", new( Vector3.Up * 32, Rotation.From( 0, rot, 90 ), 0.05f ), size: 64 );
Gizmo.Draw.Color = Color.Red;
Gizmo.Draw.LineBBox( BBox.FromHeightAndRadius( 32, 16 ) );
}
}
}
To Reproduce
make a custom MapInstance
Add the component to any object (i'd assume it works on any object)
restart the game until it errors / reload the project using the launcher
Expected behavior
It should just render the WorldText and not cause an exception on project startup
Media/Files
here is the Log from one of the times it happend:
Log.log
it just prints this over and over again
[Generic] Exception in BuildFontRuns() with original length of 29 now 29, style run count 1, font run count 0, direction overrides: False System.InvalidOperationException: Exception in BuildFontRuns() with original length of 29 now 29, style run count 1, font run count 0, direction overrides: False
---> System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
at Sandbox.FontManager.TypefaceFromStyle(IStyle style, Boolean ignoreFontVariants) in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\Render\TextRendering\FontManager.cs:line 103
at Topten.RichTextKit.TextBlock.TypefaceFromStyle(IStyle style, Boolean ignoreFontVariants) in C:\build\_work\sbox\sbox\engine\ThirdParty\Topten.RichTextKit\TextBlock.cs:line 1309
at Topten.RichTextKit.TextBlock.AddDirectionalRun(StyleRun styleRun, Int32 start, Int32 length, TextDirection direction, IStyle style) in C:\build\_work\sbox\sbox\engine\ThirdParty\Topten.RichTextKit\TextBlock.cs:line 1340
at Topten.RichTextKit.TextBlock.BuildFontRuns() in C:\build\_work\sbox\sbox\engine\ThirdParty\Topten.RichTextKit\TextBlock.cs:line 1191
--- End of inner exception stack trace ---
at Topten.RichTextKit.TextBlock.BuildFontRuns() in C:\build\_work\sbox\sbox\engine\ThirdParty\Topten.RichTextKit\TextBlock.cs:line 1212
at Topten.RichTextKit.TextBlock.Layout() in C:\build\_work\sbox\sbox\engine\ThirdParty\Topten.RichTextKit\TextBlock.cs:line 366
at Topten.RichTextKit.TextBlock.get_MeasuredWidth() in C:\build\_work\sbox\sbox\engine\ThirdParty\Topten.RichTextKit\TextBlock.cs:line 540
at Sandbox.TextRendering.TextBlock.MakeReady() in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\Render\TextRendering\TextRendering.TextBlock.cs:line 128
at Sandbox.TextRendering.GetOrCreateTexture(Scope& scope, Vector2 clip, TextFlag flag, FontSmooth smooth) in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\Render\TextRendering\TextRendering.cs:line 43
at Sandbox.Graphics.DrawText(Rect& position, Scope& scope, TextFlag flags) in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\Render\Graphics.Draw.cs:line 222
at Sandbox.Graphics.DrawText(Rect& position, String text, Color color, String fontFamily, Single fontSize, Single fontWeight, TextFlag flags) in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\Render\Graphics.Draw.cs:line 214
at Sandbox.WorldTextSceneObject.RenderSceneObject() in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\Gizmos\SceneObjects\TextSceneObject.cs:line 78
at Sandbox.SceneCustomObject.RenderInternal() in C:\build\_work\sbox\sbox\engine\Sandbox.Engine\SceneSystem\SceneCustomObject.cs:line 52
Describe the bug
Alright.. this is a weird and random one. I Have a DebugComponent i create in a Custom MapInstance that puts it onto objects that i haven't implemented yet The map was made a year ago and has Entities that don't exist anymore.
I put the Component onto it during the OnCreateObject Method and it consists of a single DrawGizmos() override Sometimes when i open the project up it just causes an exception and spams the console full of errors until i restart.
Log and Stacktrace is in Media/Files
here is how i do it
To Reproduce
Expected behavior
It should just render the WorldText and not cause an exception on project startup
Media/Files
here is the Log from one of the times it happend: Log.log
it just prints this over and over again
Additional context
No response