dotnet/aspnetcore

[Analyzer] : Warn when registering custom IProblemDetailsWriter after calling AddRazorPages, etc

Open

#48,180 创建于 2023年5月10日

在 GitHub 查看
 (11 评论) (2 反应) (0 负责人)C# (10,653 fork)batch import
analyzerapi-approvedarea-mvcbughelp wanted

仓库指标

Star
 (37,933 star)
PR 合并指标
 (平均合并 16天 9小时) (30 天内合并 258 个 PR)

描述

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.

贡献者指南