Skip to content

New templates have unnecessary using statement for OpenApi #35840

Closed
@timheuer

Description

@timheuer

Describe the bug

With the change and merge of Program/Startup content for minimal hosting API support, an additional using that still exists is no longer needed due to the use of the new C# language feature and new() instead of using new OpenApiInfo() in the project file. This triggers code fixes to show that this using is not needed.

image

Generally we shouldn't emit code that our tools immediately flag as not needed.

To Reproduce

From VS:
File...New Project...Web API (C#)
Open Program.cs
OBSERVE: Roslyn grays out and lightbulbs the using Microsoft.OpenApi.Models

Further technical details

6.0.100-rc.1.21426.23
VS 2022 Int.Preview 4 (should repro on any VS2022 w/net6 sdk)

Metadata

Metadata

Assignees

Labels

area-minimalIncludes minimal APIs, endpoint filters, parameter binding, request delegate generator etcfeature-minimal-actionsController-like actions for endpoint routingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions