Could not load file or assembly … The system cannot find the file specified
yoav-melamed opened this issue · 1 comments
yoav-melamed commented
Hi Guys,
I've created a new console app in dotnet-core 3.1 Added utf8json (Install-Package Utf8Json) - v1.3.7 Write a simple code (taken for the docs):
public static void Main(string[] args)
{
var p = new TestObj { parameter = "value" };
// Object -> byte[] (UTF8)
byte[] result = JsonSerializer.Serialize(p);
// byte[] -> Object
var p2 = JsonSerializer.Deserialize<TestObj>(result);
// Object -> String
var json = JsonSerializer.ToJsonString(p2);
Console.ReadKey();
}
My TestObj class:
class TestObj
{
public string parameter { get; set; }
}
When I'm running the app, I'm getting the following:
Unhandled exception. System.TypeLoadException: Type 'Utf8Json.Formatters.mongodb_tester_TestObjFormatter1' from assembly 'Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullFalseNameMutateOriginal, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.
at Utf8Json.JsonFormatterResolverExtensions.GetFormatterWithVerify[T](IJsonFormatterResolver resolver)
at Utf8Json.JsonSerializer.Serialize[T](T value, IJsonFormatterResolver resolver)
at Utf8Json.JsonSerializer.Serialize[T](T obj)
The Utf8Json.dll exist in 'bin\Debug\netcoreapp3.1' folder
Any idea what could it be?
yoav-melamed commented
Sorry guys
Found the issue - TestObj class should be public