fsprojects / fsharp-hashcollections

Library providing fast hash based immutable map and set
MIT License
59 stars 4 forks source link

Failed to run #25

Closed iamim closed 1 year ago

iamim commented 1 year ago

I tried to use the library in a .NET 7 F# 7 project. Getting this error:

Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'FSharp.HashCollections, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.

File name: 'FSharp.HashCollections, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
   at System.Reflection.RuntimeAssembly.InternalLoad(AssemblyName assemblyName, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, RuntimeAssembly requestingAssembly, Boolean throwOnFileNotFound)
mvkara commented 1 year ago

That's odd. I'm not sure it is an error of the library though.

See https://github.com/mvkara/hash-bug-replay - tried to create a quick repro with a F# 7 project and it seemed to work just fine. Would be interested in a repro in any event in case it is an error in the way it is built.

$ dotnet --version
7.0.101
$ dotnet run
Hashset contains 6 [true]
Hashset contains 20 [false]
iamim commented 1 year ago

I'm having exactly the same error in that repo :/ Could it be due to the library targeting .NET Core 3.1? I don't have it installed (having some sort of troubles with macOS on Arm M1). Could it be solved by publishing it in .NET Standard or .NET in addition/instead?

mvkara commented 1 year ago

So I'm testing on an Intel/AMD box on a Linux machine running 7.0.101.

I suspect it is a MacOS on Arm issue - or rather that netcore3.1 may not have the compatibility required for ARM. I note that I can only download MacOS ARM from .NET 6 onwards. I'm targeting netcore3.1 as at the time the library was first written that was the minimum to support the logic required in this library (netstandard2.0 did not have the required functionality and I think netstandard2.1 wasn't available).

I can try netstandard2.1 but that knocks out some older consumers on Intel processors forcing them to upgrade potentially. Might need to release the library doing a multi target.

EDIT: Netstandard2.1 does not support the required libs either.

iamim commented 1 year ago

Thanks for considering it! My understanding was that .NET Core was a superset of .NET Standard 2.1.

mvkara commented 1 year ago

So yes - it is a Mac ARM thing I suspect. The library uses some .NET API's which are unavailable even on Net Standard 2.1.

I've created a package here: https://www.nuget.org/packages/FSharp.HashCollections/0.3.4-preview1. You may need to wait an hour or so before it it available and validates.

I've targeted the existing target but also added .net 5.0 and .net 6.0 into the mix. If you could let me know how it goes (since I don't have a Mac ARM to test on) would be great.

iamim commented 1 year ago

Got it running now, thanks!