-
Notifications
You must be signed in to change notification settings - Fork 465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CA1812 Shouldn't Fire for DebuggerTypeProxy #1708
Comments
As a further suggestion, if a type is referenced via |
In my ASP.NET Web API (not ASP.NET Core) application, I got a CA1812 warning for |
I think that the It might be too strong but we could also think about considering types declared in a |
In ASP.NET Web API, |
Thanks @KalleOlaviNiemitalo so it also makes sense to support this attribute. |
dotnet/runtime#39126 added For the sake of code that targets framework versions lower than .NET 5 though, the analyzer should recognize |
@KalleOlaviNiemitalo I have moved your 2 suggestions as different thread so that this one can move forward. |
To change how a class is displayed in the VS debugger, one defines a type proxy and then adds the DebuggerTypeProxy attribute to the original class, so that the proxy class determines what is displayed by VS instead of the original class. It is natural to make the proxy class internal, since it is not intended to be part of the API surface. (VS finds and instantiates it via reflection.) When one does this, the proxy class triggers a CA1812 warning "XXX is an internal class that is apparently never instantiated."
I propose that if an internal class is referenced in any DebuggerTypeProxy attribute in an assembly, it should not trigger CA1812.
The text was updated successfully, but these errors were encountered: