-
Notifications
You must be signed in to change notification settings - Fork 214
Description
using System.Text.Json;
using System.Text.Json.Serialization;
using NAOTJsonMissingMethod;
Sample sample = new();
JsonSerializer.Serialize(sample, SampleJsonContext.Default.Sample);
namespace NAOTJsonMissingMethod
{
internal class Sample
{
public string Property { get; set; }
}
[JsonSerializable(typeof(Sample))]
internal partial class SampleJsonContext : JsonSerializerContext
{
}
}dotnet 6.0.100-preview.7
NativeAOT 7.0.0-alpha.1.21431.2
due the compilation stage it pops warning about missing method and then after running the published binary it throws:
Unhandled Exception: System.MissingMethodException: Method not found: 'System.Text.Json.Serialization.Metadata.JsonTypeInfo1<!!0> System.Text.Json.Serialization.Metadata.JsonMetadataServices.CreateObjectInfo(System.Text.Json.JsonSerializerOptions, System.Func1<!!0>, System.Func2<System.Text.Json.Serialization.JsonSerializerContext, System.Text.Json.Serialization.Metadata.JsonPropertyInfo[]>, System.Text.Json.Serialization.JsonNumberHandling, System.Action2<System.Text.Json.Utf8JsonWriter, !!0>)'.
at Internal.Runtime.TypeLoaderExceptionHelper.CreateMissingMethodException(ExceptionStringID, String) + 0x47
at Internal.Runtime.CompilerHelpers.ThrowHelpers.ThrowMissingMethodException(ExceptionStringID, String) + 0x6
at NAOTJsonMissingMethod.SampleJsonContext.get_Sample() + 0x12
at $.
at NAOTJsonMissingMethod!+0x200305