F# discriminated union custom converter isn't used. #51481
Labels
External
This is an issue in a component not contained in this repository. It is open for tracking purposes.
✔️ Resolution: By Design
Resolved because the behavior in this issue is the intended design.
old-area-web-frameworks-do-not-use
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
Status: Resolved
Is there an existing issue for this?
Describe the bug
I have an ASP.NET .net 6 minimal API in F#. I'm trying to use a discriminated union in the API using a custom converter. It seems like when ASP.NET tries to serialize the type that it doesn't pick up the attribute on the type. I get the normal error when trying to serialize the discriminated union with the default converter. Just calling
JsonSerializer.Serialize
with the type works without issue, the issue is only when ASP.NET tries to serialize the typeExpected Behavior
It should use the custom converter I defined
Steps To Reproduce
Used the starting
dotnet new web -lang=F#
project and replaced the Program.fs with belowExceptions (if any)
No response
.NET Version
6
Anything else?
No response
The text was updated successfully, but these errors were encountered: