Skip to content
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

CA2257 should not be reported on nested types #7106

Closed
jkoritzinsky opened this issue Dec 18, 2023 · 0 comments · Fixed by #7157
Closed

CA2257 should not be reported on nested types #7106

jkoritzinsky opened this issue Dec 18, 2023 · 0 comments · Fixed by #7157
Labels
Bug The product is not behaving according to its current intended design False_Positive A diagnostic is reported for non-problematic case

Comments

@jkoritzinsky
Copy link
Member

jkoritzinsky commented Dec 18, 2023

Analyzer

Diagnostic ID: CA2257: Members defined on an interface with the 'DynamicInterfaceCastableImplementationAttribute' should be 'static'

Analyzer source

SDK: Built-in CA analyzers in .NET 8 SDK or later

Version: SDK 8.0.100

Describe the bug

The analyzer reports that nested types in a type with [DynamicInterfaceCastableImplementation] should be static, but the rationale for that rule does not apply to nested types.

Steps To Reproduce

interface Foo
{
   void Bar();
}

[DynamicInterfaceCastableImplementation]
interface FooImpl
{
     void Foo.Bar() {}

     private class C {}
}

Expected behavior

No diagnostic

Actual behavior

A diagnostic on the class declaration

Additional context

@sharwell sharwell added Bug The product is not behaving according to its current intended design False_Positive A diagnostic is reported for non-problematic case labels Dec 19, 2023
jkoritzinsky added a commit to jkoritzinsky/roslyn-analyzers that referenced this issue Jan 23, 2024
jkoritzinsky added a commit to jkoritzinsky/roslyn-analyzers that referenced this issue Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The product is not behaving according to its current intended design False_Positive A diagnostic is reported for non-problematic case
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants