System.Text.Json NotSupportedException
See original GitHub issueException message:
System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances are not supported. Path: $.Data.Exception.TargetSite.MethodHandle.Value.
---> System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances are not supported.
at System.Text.Json.Serialization.Converters.UnsupportedTypeConverter`1.Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.Metadata.JsonPropertyInfo`1.GetMemberAndWriteJson(Object obj, WriteStack& state, Utf8JsonWriter writer)
at System.Text.Json.Serialization.Converters.ObjectDefaultConverter`1.OnTryWrite(Utf8JsonWriter writer, T value, JsonSerializerOptions options, WriteStack& state)
at System.Text.Json.Serialization.JsonConverter`1.TryWrite(Utf8JsonWriter writer, T& value, JsonSerializerOptions options, WriteStack& state
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
Why does System.Text.Json throw a ` ...
Your code is failing during serialization not deserialization because you are catching some inner exception and trying to serialize it with ...
Read more >Serialization and deserialization of 'System.Type' instances ...
DataType. System.NotSupportedException: Serialization and deserialization of 'System.Type' instances are not supported. at System.Text.Json.
Read more >Serialization and deserialization of 'System.IntPtr' instances ...
System.NotSupportedException: Serialization and deserialization of 'System.IntPtr' instances are not supported. at System.Text.Json.
Read more >How to Serialize Exceptions as JSON in .NET
Serialize() on the exception object, we encounter a NotSupportedException : Serialization and deserialization of 'System.Reflection.MethodBase' ...
Read more >Serialization and deserialization of 'System.Action' instances ...
System. NotSupportedException : Serialization and deserialization of ' System. ... Using JSON IN C#! Serialization & Deserialization made easy!
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I don’t think this is an issue in the framework code. If you’re curious what’s causing the issue you could try to view the exception being thrown from your API and see what types are on it that aren’t serializer friendly.
I am going to move this to ASP.NET. It seems the JSON serializer is working as expected, the caller is SystemTextJsonOutputFormatter.