aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Use more localized strategy for resolving WellKnownTypes in analyzers

Open captainsafia opened this issue 3 years ago • 1 comments

Currently, the analyzers in src/Framework resolve for a set of common types related to the area that the analyzer. For example, the route handler analyzers will attempt to resolve the types defined here. Generally, each type that is resolve is required for one or more analyzers. However, if any of the types fail to be resolved then all of the analyzers will fail to run because of this check:

https://github.com/dotnet/aspnetcore/blob/ce2db7ea0b161fc5eb35710fca6feeafeeac37bc/src/Framework/AspNetCoreAnalyzers/src/Analyzers/RouteHandlers/RouteHandlerAnalyzer.cs#L33-L37

We should consider making the type resolution a little more fine-grained to the analyzers that specifically need it so that we don't fail outright for analyzers that don't have it. For example, the only type that matters for all route handler analyzers is EndpointRouteBuilderExtensions which is used to check if the invocations in an app are MapAction invocations. The other types resolved are only required for certain analyzers.

captainsafia avatar Sep 20 '22 16:09 captainsafia

Thanks for contacting us.

We're moving this issue to the .NET 8 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

ghost avatar Sep 22 '22 17:09 ghost

Closing as we've done a good job of fixing up how we handle WellKnownTypes here.

captainsafia avatar Jan 30 '23 18:01 captainsafia