Godot Parameter Path is empty exception

Thank you for seeking help! Our friendly community is here to assist you. :pray:

To assist you better, please consider providing:

  • Objective: I am trying to access the Projects from within a C# project in Godot.

  • Issue: When I try to access ProjectResources from an active User, I get this error, it doesnā€™t matter whether async or not. It happens only when running within Godot; running in a plain console app causes no issue. The trace isnā€™t very helpful.

Before I go down a rabbit hole trying to figure out what ā€œParameter Pathā€ is I was hoping the team can help figure out what I need to populate that speckle is reaching for.

StackTrace

GodotSharp.dll!Godot.DelegateUtils.InvokeWithVariantArgs(nint delegateGCHandle, void* trampoline, Godot.NativeInterop.godot_variant** args, int argc, Godot.NativeInterop.godot_variant* outRet) Line 623
	at Godot\DelegateUtils.cs(623)

System.AggregateException
  HResult=0x80131500
  Message=One or more errors occurred. (The path is empty. (Parameter 'path'))
  Source=System.Private.CoreLib
  StackTrace:
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at AttributeProject.OnAccountSelected(Int64 index) in D:\GODOT\SPECKLEDRAW\SPECKLEDRAW\UxComponents\AttributeEditor\AttributeProject.cs:line 58
   at Godot.OptionButton.ItemSelectedTrampoline(Object delegateObj, NativeVariantPtrArgs args, godot_variant& ret) in Godot\OptionButton.cs:line 492
   at Godot.DelegateUtils.InvokeWithVariantArgs(IntPtr delegateGCHandle, Void* trampoline, godot_variant** args, Int32 argc, godot_variant* outRet) in Godot\DelegateUtils.cs:line 620

  This exception was originally thrown at this call stack:
    [External Code]

Inner Exception 1:
ArgumentException: The path is empty. (Parameter 'path')

I realised the intial stack trace isnā€™t helpful so opened up the speckle API.

at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
at Speckle.Core.Logging.SpeckleLog.GetFileVersionInfo() in Speckle.Core.Logging\SpeckleLog.cs:line 137
at Speckle.Core.Logging.SpeckleLog.CreateConfiguredLogger(String hostApplicationName, String hostApplicationVersion, SpeckleLogConfiguration logConfiguration) in Speckle.Core.Logging\SpeckleLog.cs:line 66
at Speckle.Core.Logging.SpeckleLog.Initialize(String hostApplicationName, String hostApplicationVersion, SpeckleLogConfiguration logConfiguration) in Speckle.Core.Logging\SpeckleLog.cs:line 53
at Speckle.Core.Logging.SpeckleLog.get_Logger() in Speckle.Core.Logging\SpeckleLog.cs:line 36
at Speckle.Core.Api.Client.<ExecuteGraphQLRequest>d__44`1.MoveNext() in Speckle.Core.Api\Client.cs:line 219
at Speckle.Core.Api.GraphQL.Resources.ActiveUserResource.<GetProjects>d__3.MoveNext() in Speckle.Core.Api.GraphQL.Resources\ActiveUserResource.cs:line 36

The appears to me that Speckle is getting the assembly location in windows when running the API which returns null when running Godot I suspect as its doing something different at its core and bridging.

// Get the path to the currently executing assembly
string executablePath = Assembly.GetExecutingAssembly().Location;

// Check that executablePath is not empty
if (!string.IsNullOrEmpty(executablePath))
{
    // Use this path with GetVersionInfo
    var versionInfo = FileVersionInfo.GetVersionInfo(executablePath);
}
else
{
    Console.WriteLine("Executable path is empty.");
}

For example this simple method running in Godot will return empty for the location.
I need to run a special Godot OS method called string executablePath = OS.GetExecutablePath();

Is there a simple way to override the execution path so it can get a valid Path.

Have you checked out the SpecklePathProvider.OverrideApplicationDataPath function? You should beable to override the paths the sdk uses. The class also allows for overriding of several other paths, so you may need to experiment a little.

Depending on your apps needs, it may be important to keep this pointing towards the default app data directory (%appdata%/speckle)

Iā€™m curious which functions are returning null for these paths in Godot, if you find out, please let me know.

Ps, super cool to hear some godot activity with Speckle :raised_hands:

2 Likes

Hey Jedd

Thanks for the response.

The error occurs when I try and GetProjects()
I can get the activeUser but I cannot get the list of projects.

I tried a direct override to the log file but I still get the same error.
SpecklePathProvider.OverrideApplicationDataPath(@"C:\Users\Adam\AppData\Roaming\Speckle\Logs\SpeckleDraw0.0.1");

Iā€™ll play around here, I think its the log file creation as I can see logs from other applications and the folder for my application but it doesnā€™t create any logs.

But I have no issues when I run my console tests so there is just something missing in that bridge.

Addition information.

I can confirm the log path is set correctly when I run the following method.
var logLocation = SpecklePathProvider.LogFolderPath("SpeckleDraw","0.0.1");

However, as soon as I run var projects = await activeUser.GetProjects(); it seems to have lost that location and tries to push an empty string into System.Diagnostics.FileVersionInfo.GetVersionInfo(string) in FileVersionInfo.cs

Iā€™m thinking that, its not an issue with the path provider paths, but instead when we try and gather the location of the current executing assembly.

Please could you run a test for me, inside of GoDot, Iā€™d like to understand what Assembly.GetExecutingAssembly().Location returns inside of GoDot.

It should return the path that the speckle.core.dll exists inā€¦ but if for what ever reason, this becomes null, I can see why our core may start exploding unpredictably.

Hi Jedd

It returns empty.
I put that code in the first reply on this thread for reference.

I need to run a Godot command string executablePath = OS.GetExecutablePath(); in order for Godot to return its executing location.

Iā€™m guessing Godot has to provide its own method to detect the OS to deal with the file service differences as it runs on Linux, Mac and on the Web OOTB.

I have a potential fix on this git branch:

I presume youā€™re consuming core through a nuget currently, are you able to perform a local build of this git branch and help me test this?

1 Like

I should also ask, what version of Godot are you building under?

Thank you for the quick turnaround.

Currently using 4.3 but Iā€™ve been using Godot since version 3 so Iā€™ll run tests on both and let you know if there are any issues.

Just building the branch and will let you know the outcomes shortly.

1 Like

Hey Jedd

I loaded the Project directly.

Thanks for the commit, there is one slight change that needs to occur the check needs to look for a null or empty string.

I have commented on the commit for your reference.
This has correctly returned the project list.

Iā€™m unsure of the ramifications of this on Speckle, but the branch works with this change.

Thanks for all your assistance.

1 Like

Thanks, Iā€™ve updated the PR to use IsNullOrEmpty.
Hopefully this will resolve your issue.

Iā€™ll let you know when we next make a release.

1 Like

HI @AdamS

Nuget verisons 2.20.5 now contains this change.

Please let me know if you encounter any other problems

1 Like