[Analyzer] : Warn when registering custom IProblemDetailsWriter after calling AddRazorPages, etc
#48.180 geöffnet am 10. Mai 2023
Repository-Metriken
- Stars
- (37.933 Stars)
- PR-Merge-Metriken
- (Durchschn. Merge 16T 9h) (258 gemergte PRs in 30 T)
Beschreibung
Background and Motivation
Registering a custom IProblemDetailsWriter after calling AddRazorPages, etc results in the DefaultProblemDetailsWriter, not the custom IProblemDetailsWriter being called.
Proposed Analyzer
Analyzer Behavior and Message
Issue a warning when Registering a custom IProblemDetailsWriter after calling AddRazorPages, etc.
ASP0001: Authorization middleware is incorrectly configured is similar.
See https://github.com/dotnet/AspNetCore.Docs/issues/29152
Note: When using a custom IProblemDetailsWriter, the custom IProblemDetailsWriter must be registered before calling AddRazorPages, AddControllers, or AddControllersWithViews.
Category
- Design
- Documentation
- Globalization
- Interoperability
- Maintainability
- Naming
- Performance
- Reliability
- Security
- Style
- Usage
Severity Level
- Error
- Warning
- Info
- Hidden
Usage Scenarios
Issue a warning when Registering a custom IProblemDetailsWriter after calling AddRazorPages, etc.
Risks
None.