CookieBadger / assetplacer-docs

Other
8 stars 0 forks source link

Error Spam When Opening Project #11

Open ptlthg opened 9 months ago

ptlthg commented 9 months ago

I get the following two errors spammed in my console when opening my 4.2 project with asset placer enabled. I can't seem to reproduce these reliably, but these errors are printed every frame, so I've had to edit the code myself to stop them. (By adding a null check and a TryGetValue)

System.NullReferenceException: Object reference not set to an instance of an object.
     at AssetPlacer.AssetPlacerPlugin.SetToolTip(String text, Color[] colors) in G:\Godot\DungeonGame\addons\assetplacer\AssetPlacerPlugin.cs:line 531
     at AssetPlacer.AssetPlacerPlugin._ProcessUpdate(Double delta) in G:\Godot\DungeonGame\addons\assetplacer\AssetPlacerPlugin.cs:line 621
     at AssetPlacer.ContextlessPlugin._Process(Double delta) in G:\Godot\DungeonGame\addons\assetplacer\utils\contextlessPlugin\ContextlessPlugin.cs:line 155
     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 2111
     at Godot.EditorPlugin.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharpEditor/Generated/GodotObjects/EditorPlugin.cs:line 1352
     at AssetPlacer.ContextlessPlugin.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in G:\Godot\DungeonGame\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\AssetPlacer.ContextlessPlugin_ScriptMethods.generated.cs:line 250
     at AssetPlacer.AssetPlacerPlugin.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in G:\Godot\DungeonGame\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\AssetPlacer.AssetPlacerPlugin_ScriptMethods.generated.cs:line 440
     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
  System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
     at Godot.Collections.Dictionary`2.get_Item(TKey key) in /root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/Dictionary.cs:line 644
     at AssetPlacer.AssetPlacerUi.SetAssetBroken(String selectedAssetPath, Boolean broken) in G:\Godot\DungeonGame\addons\assetplacer\ui\AssetPlacerUi.cs:line 728
     at AssetPlacer.AssetPalette.OnPreviewLoaded(String assetPath, Variant preview) in G:\Godot\DungeonGame\addons\assetplacer\assetPalette\AssetPalette.cs:line 592
     at AssetPlacer.AssetPalette.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in G:\Godot\DungeonGame\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\AssetPlacer.AssetPalette_ScriptMethods.generated.cs:line 457
     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

Not sure if just adding checks is enough to fix it or if this is a symptom of a bigger issue, but I've had to replace dictionary lookups in the code for asset placer buttons with TryGetValue for the last couple of Asset Placer versions because I keep running into that error in particular.

Let me know if there's any more information you need, thanks

CookieBadger commented 9 months ago

Hey, thanks for reporting and I'm sorry that you had these issues. As it seems you were able to fix it for now, I'll look into this when I'll work on the next version, but please let me know if something comes up again.

CookieBadger commented 8 months ago

Hey @ptlthg I just uploaded AssetPlacer 1.2.2 which fixes at least the second issue you had. I have so far not been able to reproduce the first issue, so could you let me know, if it still appears with the upgrade, now that the initialization works properly?

ptlthg commented 8 months ago

Thanks for the update!

I just tried it out a bit more today. I'm not sure if it matters, but I left Godot running with the plugin in the background for a few hours and when I came back to it the same first error started spamming again in the console. The console tab was open while this was happening, and moved my mouse around to hit the clear console button also while this was still happening.

The second error hasn't happened again though, but I only used the plugin actively for maybe an hour, so I can't say for sure if it's gone.

/root/godot/modules/mono/glue/GodotSharp/GodotSharp/Core/NativeInterop/ExceptionUtils.cs:112 - System.NullReferenceException: Object reference not set to an instance of an object.
     at AssetPlacer.AssetPlacerPlugin.SetToolTip(String text, Color[] colors) in G:\Godot\DungeonGame\addons\assetplacer\AssetPlacerPlugin.cs:line 531
     at AssetPlacer.AssetPlacerPlugin._ProcessUpdate(Double delta) in G:\Godot\DungeonGame\addons\assetplacer\AssetPlacerPlugin.cs:line 621
     at AssetPlacer.ContextlessPlugin._Process(Double delta) in G:\Godot\DungeonGame\addons\assetplacer\utils\contextlessPlugin\ContextlessPlugin.cs:line 155
     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 2111
     at Godot.EditorPlugin.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in /root/godot/modules/mono/glue/GodotSharp/GodotSharpEditor/Generated/GodotObjects/EditorPlugin.cs:line 1352
     at AssetPlacer.ContextlessPlugin.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in G:\Godot\DungeonGame\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\AssetPlacer.ContextlessPlugin_ScriptMethods.generated.cs:line 250
     at AssetPlacer.AssetPlacerPlugin.InvokeGodotClassMethod(godot_string_name& method, NativeVariantPtrArgs args, godot_variant& ret) in G:\Godot\DungeonGame\Godot.SourceGenerators\Godot.SourceGenerators.ScriptMethodsGenerator\AssetPlacer.AssetPlacerPlugin_ScriptMethods.generated.cs:line 440
     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