Cysharp / R3

The new future of dotnet/reactive and UniRx.
MIT License
1.71k stars 70 forks source link

[Godot] Ensure that ObservableTrackerDebuggerPlugin sessions Dictionary is no… #224

Closed KAW0 closed 1 week ago

KAW0 commented 2 weeks ago

With Godot 4.3beta2 it seems that #125 is finally fixed R3 is finally usable with Godot but there is another problem. I'm not sure if it's introduced in this version or previous. If you enable R3 as plugin and then rebuild C# project without previous running debugging session plugin will try to call ObservableTrackerDebuggerPlugin.UpdateTrackingStates while Dictionary<int, TrackerSession> sessions is empty which will cause exception.


/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:113 - System.Collections.Generic.KeyNotFoundException: The given key '0' was not present in the dictionary.
     at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
     at R3.ObservableTrackerDebuggerPlugin.UpdateTrackingStates(Int32 sessionId, Boolean forceUpdate) in D:\Projects\Other\UnloadingIssue\addons\R3.Godot\ObservableTrackerDebuggerPlugin.cs:line 126
     at R3.ObservableTrackerTab._Process(Double delta) in D:\Projects\Other\UnloadingIssue\addons\R3.Godot\ObservableTrackerTab.cs:line 129
     at Godot.Node.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/Node.cs:line 2395
     at Godot.CanvasItem.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/CanvasItem.cs:line 1504
     at Godot.Control.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/Control.cs:line 2912
     at Godot.Container.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/Container.cs:line 137
     at Godot.BoxContainer.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/BoxContainer.cs:line 136
     at Godot.VBoxContainer.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Generated/GodotObjects/VBoxContainer.cs:line 42
     at R3.ObservableTrackerTab.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in D:\Projects\Other\UnloadingIssue\.godot\mono\temp\obj\Debug\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\R3.ObservableTrackerTab_ScriptMethods.generated.cs:line 80
     at Godot.Bridge.CSharpInstanceBridge.Call(IntPtr godotObjectGCHandle, godot_string_name* method, godot_variant** args, Int32 argCount, godot_variant_call_error* refCallError, godot_variant* ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Bridge/CSharpInstanceBridge.cs:line 24
neuecc commented 1 week ago

I don't know the details of Godot, but it looks like a more secure code, so I'll try to Merge it. Thanks.