[ANN] ClojureCLR 1.12.3-alpha1 released
The big update for this release is a significant improvement for type resolution.
This work is the effort of Emil Järvinen @jarvinenemil.
Here are his notes on the commit. I've bolded the most important points:
> This commit comprehensively fixes type resolution issues in .NET Core/.NET 5+ environments
> and adds tests to verify the functionality.
>
> Key improvements:
>
> 1. Type Resolution (classForName):
> - Add DependencyContext for runtime assembly discovery
> - Implement multi-tier resolution strategy with clear priorities
> - Fix loading of types from NuGet packages
> - Handle framework types in separate assemblies (e.g. System.Collections.Concurrent)
> - Load shared runtime libraries via TrustedPlatformAssemblies property
>
> 2. Shared Runtime Library Loading:
> - Use AppContext.GetData("TRUSTED_PLATFORM_ASSEMBLIES") to access shared .NET runtime
> - Includes assemblies from shared frameworks
>
> 3. Fix duplicate type handling in CreateDefaultImportDictionary:
> - Handle cases where the same type name appears in multiple assemblies
> - Prevents ArgumentException during RT initialization in .NET Core/5+
>
> 4. Dependencies:
> - Add Microsoft.Extensions.DependencyModel package for assembly discovery
>
> 5. Tests:
> - Verification of TRUSTED_PLATFORM_ASSEMBLIES availability
> - Loading types from shared runtime libraries (System.Collections.Concurrent, System.Text.Json, etc.)
> - Handling of duplicate type names across assemblies
> - Loading types from NuGet packages via DependencyContext
>
> This fixes long-standing issues with Clojure CLR not finding types in external assemblies.
This means that places where you might have been doing explicit assembly loads may no longer require that.
This code updated uses AppContext.GetData -- this method is not available in Framework 4.62. It was added in 4.7.
So there will be some improvement for 4.6.2, but not all of the goodness is available.
To make up for this, I added a build for Framework 4.8.1. If you are committed to Framework, I recommend moving up to 4.8.1 if possible.
This alpha release does not yet have the updates for type aliasing mentioned in recent threads.
I ran into some ... let's call them 'nuances' of the CLR type system.
If you've never looked at the details of nested types of generic types, I recommend you remain ignorant.
All I'll say is that even ILSpy, one my greatest friends, displays incorrect type names in some places.
When I have to go to ildasm for help, you know things are complicated.
Hoping to have the type alias work in the next alpha, coming soon.
you can require clojure-clr packages and other packages from nuget in your .csproj and also use shared .NET runtimes such as building a web application instead of wrangling Assembly.Load manually.
This sounds like it will help me clean up my init/helper scripts or maybe even remove them entirely . I look forward to trying it out . Thanks
@jamesdavidson I'm interested in the results of your experiment. Also to whatever degree is possible, to know what you're doing in the init/helper scripts and what things we might do to ease the burden. We're looking at providing additional tooling for app building and deployment.
🙌