Net7 plugin fails to load if it was loaded already

On net7, the second time loading my plugin it fails to find FSharp.Core.

The first time loading all is good.

After reverting to net48 runtime and back to net7 it works again, but just once. After restarting rhino it fails to load. (Staying on net48 it works)

What happens when a plugin is first loaded?

@eirannejad Did you say once FSharp.Core is preloaded in Rhino ?

System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'FSharp.Core, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
   at System.ModuleHandle.ResolveType(QCallModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(MetadataToken caCtorToken, MetadataImport& scope, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1& derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctorWithParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
   at Rhino.Runtime.HostUtils.CreatePlugIn(Type pluginType, Assembly pluginAssembly, Boolean printDebugMessages, Boolean useRhinoDotNet)
   at Rhino.Runtime.HostUtils.CreatePlugIn(Type pluginType, Boolean printDebugMessages)
   at Rhino.PlugIns.PlugIn.CreateFromAssembly(Assembly pluginAssembly, Boolean displayDebugInfo, Boolean useRhinoDotNet)
Unable to load Fesh.Rhino.rhp plug-in: initialization failed.

(Rh 8.23.25224.02001 on Windows)

I am intrigued by F# and would like to try Fesh with Rhino, but this situation with .NET Core is somewhat messing up my work environment. Has there been any news on this topic?

Yes, I really enjoy scripting with F#. (My Python scripts just grew too large.) However, issues with dll loading keep on popping up, in Fesh.Revit too. I might try to use IL Merge to bundle all references into one dll. Just like other F# tools are doing it: Paket/build.fsx at 1054e37e45e75a6ed8c33c76e66fe83bc4d0fcbe · fsprojects/Paket · GitHub

but if you stay on net48 Fesh in Rhino should work fine

still the same problem :grimacing:

@curtisw @eirannejad Did you say once FSharp.Core is preloaded in Rhino ?

using dotnet publish --self-contained instead of dotnet build fixed it.