Skip to content

How to use legacy error format along side new ProblemDetails format depending upon API Version? #1072

Discussion options

You must be logged in to vote

Ah... I see the issue. This is because the JsonSerializerContext is defined by a source code generator. The Error Object types are protected to the writer itself, but are internal for the JsonSerializerContext. Once you inherit from it, they aren't visible in your derived implementation. The types themselves are structs so you can't inherit from them (which might have been a sleezy trick). The only thing you really need is the JsonSerializerContext, but since it's internal and the only thing that uses it is IConfigureOptions<T>, which is also internal, there's no way to access it without resorting to Reflection. 🤮

Arguably, this is a design flaw. It wasn't really clear to me how this migh…

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@commonsensesoftware
Comment options

Comment options

You must be logged in to vote
3 replies
@commonsensesoftware
Comment options

Answer selected by mhsimkin
@mhsimkin
Comment options

@commonsensesoftware
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants