Thank you for seeking help! Our friendly community is here to assist you.
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.
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
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.
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.
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.