System.TypeLoadException: attempting to implement an inaccessible interface
maurosampietro opened this issue · 0 comments
maurosampietro commented
I'm trying to parse a very simple json
string json = @"{
""Email"": ""mauro.sampietro@gmail.com"",
""Active"": ""true"",
""CreatedDate"": ""2013-01-20T00:00:00Z"",
""Roles"":
[
""User"",
""Admin""
]
}";
public class Item
{
public string id { get; set; }
public string ppu { get; set; }
public Batters batters { get; set; }
public Ingredient[] toppings { get; set; }
}
public class Batters
{
public List<Ingredient> batter { get; set; }
}
public class Ingredient
{
public string id { get; set; }
public string type { get; set; }
}
static void Main(string[] args)
{
var item = JsonSerializer.Deserialize<Item>( json );
}
I get System.TypeLoadException: 'Type 'Utf8Json.Formatters.Program+ItemFormatter1' from assembly 'Utf8Json.Resolvers.DynamicObjectResolverAllowPrivateFalseExcludeNullFalseNameMutateOriginal, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' is attempting to implement an inaccessible interface.'
I'm executing this in the 'PerfBenchmark' project provided with the sourcecode to avoid any possible misconfiguration.
What's the problem?