dotnet / dotnet/aspnetcore

Feature request: Run analyzers in debug mode

Open
#18,791 6 comments 2 reactions 0 assignees View on GitHub
affected-medium area-networking enhancement feature-platform severity-nice-to-have
Dominant language
C#
Stars
38.4k
Forks
10.9k
Avg merge
2d 6h
Merged PRs (30d)
290

Description

Problem motivation: #18768, `app.UseSpa` was in the wrong order.

Add ` app.UseRunAllAnalyzers` to template code to detect middleware order and other problems.

```
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseDatabaseErrorPage();
app.UseRunAllAnalyzers(); // run middleware order check and other checks
}
else
{
app.UseExceptionHandler("/Error");
app.UseHsts();
}

...
```

`UseRunAllAnalyzers` could be updated frequently to add more checks.

See https://twitter.com/davidfowl/status/1228902288627912705 where `@davidfowl` requests this.

cc @javiercn

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.