-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Document new ExceptionHandlerOptions.SuppressDiagnosticsCallback setting #36157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: tdykstra <[email protected]>
ExceptionHandlerOptions.SuppressDiagnosticsCallback
setting -- part 2 code and text for the new featureThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot This looks really good! I just left a couple suggestions, which I'd like to resolve before asking others to review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tdykstra, Looks good, approved, assuming the change you suggested is committed.
`IExceptionHandler` implementations are registered by calling [`IServiceCollection.AddExceptionHandler<T>`](/dotnet/api/microsoft.extensions.dependencyinjection.exceptionhandlerservicecollectionextensions.addexceptionhandler). The lifetime of an `IExceptionHandler` instance is singleton. Multiple implementations can be added, and they're called in the order registered. | ||
|
||
If an exception handler handles a request, it can return `true` to stop processing. If an exception isn't handled by any exception handler, then control falls back to the default behavior and options from the middleware. Different metrics and logs are emitted for handled versus unhandled exceptions. | ||
The built-in implementation works by iterating through the registered exception handlers in order until one returns `true` from `TryHandleAsync`, indicating that the exception has been handled. If an exception handler handles an exception, it can return `true` to stop processing. If an exception isn't handled by any exception handler, then control falls back to the default behavior and options from the middleware. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The built-in implementation works by iterating through the registered exception handlers
The built-in implementation of what? I don't think this is clear.
I think it should be rephrased to something like:
Exception handling middleware interates through registered exception handlers...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to clarify that it's the exception handling middleware that iterates through registered exception handlers. See commit 2c8a4e5.
One thing that I commented above. Otherwise it looks good. |
Co-authored-by: JamesNK <[email protected]>
Fixes #36057
Fixes #35852
This PR documents the new
SuppressDiagnosticsCallback
setting introduced in .NET 10 as part of the exception handler middleware improvements.Changes Made
Enhanced IExceptionHandler Documentation
IExceptionHandler
contains a single method (TryHandleAsync
)Documented .NET 10 Breaking Change
Added New Configuration Section
Created a dedicated "SuppressDiagnosticsCallback" section with practical code examples:
Revert to .NET 8/9 behavior:
Conditional suppression based on exception type:
Added Documentation Links
Updated Metadata
ai-usage: ai-assisted
metadata as requiredms.date
to current dateReview Feedback Addressed
The documentation now provides developers with clear guidance on how to configure exception diagnostics behavior in .NET 10 while maintaining backward compatibility options.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.