Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FSharp.Core 4.7 not found when calling Serialize from net48 project using F#6 #105

Open
tymokvo opened this issue May 4, 2022 · 0 comments

Comments

@tymokvo
Copy link

tymokvo commented May 4, 2022

Hello,

I'm trying to use a method that calls JsonSerializer.Serialize in one of my libraries from a .fsx script. The script looks like:

#r "MyLib.dll"
open MyLib

let m = Map.ofArray [|("a", 1)|]

MyLib.serialize m

The library references "FSharp.SystemTextJson" Version="0.17.4"

Whenever I hit the code path that calls Serialize I get the traceback:

Could not load file or assembly 'FSharp.Core, Version=4.7.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
   at System.Text.Json.Serialization.JsonFSharpConverter.CanConvert(Type typeToConvert)
   at System.Text.Json.JsonSerializerOptions.GetConverter(Type typeToConvert)
   at System.Text.Json.JsonSerializerOptions.DetermineConverterForProperty(Type parentClassType, Type runtimePropertyType, PropertyInfo propertyInfo)
   at System.Text.Json.JsonClassInfo.GetImplementedCollectionType(Type parentClassType, Type queryType, PropertyInfo propertyInfo, JsonConverter& converter, JsonSerializerOptions options)
   at System.Text.Json.JsonClassInfo.GetClassType(Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonClassInfo..ctor(Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializerOptions.GetOrAddClass(Type classType)
   at System.Text.Json.WriteStackFrame.Initialize(Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.WriteCore(Utf8JsonWriter writer, PooledByteBufferWriter output, Object value, Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.WriteCore(PooledByteBufferWriter output, Object value, Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.WriteCoreString(Object value, Type type, JsonSerializerOptions options)
   at System.Text.Json.JsonSerializer.Serialize[TValue](TValue value, JsonSerializerOptions options)

Even though FSharp.Core 6.0 is available on the probing path and the NuGet depedencies indicate that this should work with F# >= 4.7. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant