[BUG] DiagnosticHostedService fails with NotSupportedException when DynamicProviders.PathMatchingCallback is set #493
Unanswered
DaleyKD
asked this question in
IdentityServer
Replies: 1 comment 1 reply
-
|
Thanks for reporting this issue! Just to clarify, was this an actual issue you've encountered while running Duende IdentityServer, or was this something flagged by AI? We're trying to determine the severity of the issue, since this issue doesn't prevent IdentityServer from functioning, it only impacts the |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Please keep in mind this was investigated by AI and the bug report was also written by it.
Description
When using a custom
PathMatchingCallbackfor dynamic identity providers, theDiagnosticHostedServicethrows aNotSupportedExceptionat startup because it attempts to JSON-serialize theIdentityServerOptionsobject, which contains aFunc<HttpContext, Task<string>>delegate that cannot be serialized.Version
Steps to Reproduce
PathMatchingCallback:DiagnosticHostedServicethrows an exception during startupExpected Behavior
The application should start successfully. The diagnostic service should either:
PathMatchingCallbackwith[JsonIgnore]Actual Behavior
The application throws a
NotSupportedExceptionwith the message:Full Stack Trace
Suggested Fix
Add
[JsonIgnore]attribute to thePathMatchingCallbackproperty inDynamicProviderOptions, or configure a customJsonSerializerOptionsinIdentityServerOptionsDiagnosticEntry.WriteAsyncthat ignores delegate types.Workaround
As a temporary workaround, we're removing the
DiagnosticHostedServicefrom the service collection:Beta Was this translation helpful? Give feedback.
All reactions