Fork me on GitHub
#clr
<
2023-09-08
>
selfsame04:09:35

@dmiller hi! small issue https://github.com/clojure/clojure-clr/blob/master/Clojure/Clojure/Lib/RT.cs#L3404 can return an empty string on net 5+ which throws a System.ArgumentNullException. https://learn.microsoft.com/en-us/dotnet/api/system.reflection.assembly.location?view=net-7.0 says that "In .NET 5 and later versions, for bundled assemblies, the value returned is an empty string." apologies for not using JIRA couldn't figure out an account

Daniel Gerson20:10:24

Thought I'd just add some context for ☝️, given this question looks stale. Selfsame is maintaining a Clojure bridge (bootstrap and Arcadia API) for the Godot game engine :robot_face:. He's trying to upgrade to the shiny https://godotengine.org/article/godot-4-1-is-here/ but has hit a snag with the latest CLR Clojure.dll , which https://github.com/arcadia-unity/ArcadiaGodot/blob/godot4/journal.md. The issue appears to be related to step 4 from the https://github.com/clojure/clojure-clr/blob/master/docs/what-a-load-of-clojure.md#where-do-we-look CLR supporting doc, which suggests step 4 may be redundant anyway!? I'm not entirely sure why this code path doesn't trigger in other scenarios, but I can confirm it triggers when the Godot bootstrap code RT.load("clojure/core"); runs https://github.com/arcadia-unity/ArcadiaGodot/blob/godot4/ArcadiaHook.cs#L104. The reason in this case is as he's mentioned above. (Further to his explanation`Path.GetDirectoryName` returns null for the empty string passed, which Path.Combine finally errors on. :ladybug: ). If the offending line (step 4) can't be removed, or put behind a flag, is it possible that Selfsame can please be assisted by someone who knows the CLR?

💯 4
dmiller03:11:25

@U0FEXTR8Q @U03B2SRNYTY Been away for a few days. I'll take a look at this tomorrow and get back to you.

Daniel Gerson08:11:34

@dmiller Thanks so much! Much appreciated 🙏 Also, hope it was a good break (if it was a break).

dmiller06:11:20

Hit crunch time on a project. At this point in life, only so much focus to go around. I should be back being more active in another week or so. I missed the original post. Don't hesitate to reach out to me directly in whatever channel works, including email. The quick fix is just to drop in this replacement (just above the method listed above): public static IEnumerable<string> GetFindFilePaths() { return GetFindFilePathsRaw().Where(p => p != null).Distinct(); } Assuming you don't mind compiling the C# source. I should be able to get another alpha release out tomorrow.

Daniel Gerson16:11:08

I tried, but it's still failing. It could be that it's not seeing my change. Unfortunately I can't get debugging working in the library code (works in the first ArcadiaHook.cs file) despite copying the PDBs and messing around with "justMyCode":false, in VsCode. Perhaps something about the way that it launches natively and then loads .NET (unfamiliar with Godot). Or perhaps it doesn't like my Apple M1 Pro (I have an Alienware Windows PC I could get up and running). Lots of slow downs re process including realising that I needed .NET 7.0 even though I only want the .NET 6.0 DLLs (CLR won't build). Don't think I want to pick it up again unless I get debugging working, or I'm liable to just hit the next road block...

Daniel Gerson16:11:44

static IEnumerable<string> GetFindFilePathsRaw()
        {
            yield return System.AppDomain.CurrentDomain.BaseDirectory;
            yield return Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "bin");
            yield return Directory.GetCurrentDirectory();

            Assembly assy = Assembly.GetEntryAssembly();
            if ( assy != null)
            {
                string assyLocation = Path.GetDirectoryName(assy.Location);
                if (!string.IsNullOrEmpty(assyLocation))
                    yield return Path.GetDirectoryName(assy.Location);
            }
Your change looks nicer than mine 😂 . Clearly I'm not a C# person.

dmiller03:11:54

Let's combine. my filter really should use IsNullOrEmpty or IsNullOrWhitespace.

selfsame04:11:13

public static IEnumerable<string> GetFindFilePaths()
        {
            return GetFindFilePathsRaw().Where(p => !string.IsNullOrEmpty(p)).Distinct();
        }
hey that does fix the filepaths exception! @U03B2SRNYTY I'll keep poking at it. Thank you both!

🎉 1
Daniel Gerson11:11:36

Woohoo, thanks both!

dmiller20:02:10

The patch is in the alpha9 release as of today.

🙌 1
Daniel Gerson20:10:24

Thought I'd just add some context for ☝️, given this question looks stale. Selfsame is maintaining a Clojure bridge (bootstrap and Arcadia API) for the Godot game engine :robot_face:. He's trying to upgrade to the shiny https://godotengine.org/article/godot-4-1-is-here/ but has hit a snag with the latest CLR Clojure.dll , which https://github.com/arcadia-unity/ArcadiaGodot/blob/godot4/journal.md. The issue appears to be related to step 4 from the https://github.com/clojure/clojure-clr/blob/master/docs/what-a-load-of-clojure.md#where-do-we-look CLR supporting doc, which suggests step 4 may be redundant anyway!? I'm not entirely sure why this code path doesn't trigger in other scenarios, but I can confirm it triggers when the Godot bootstrap code RT.load("clojure/core"); runs https://github.com/arcadia-unity/ArcadiaGodot/blob/godot4/ArcadiaHook.cs#L104. The reason in this case is as he's mentioned above. (Further to his explanation`Path.GetDirectoryName` returns null for the empty string passed, which Path.Combine finally errors on. :ladybug: ). If the offending line (step 4) can't be removed, or put behind a flag, is it possible that Selfsame can please be assisted by someone who knows the CLR?

💯 4