diff --git a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/NestedTypesShouldNotBeVisible.cs b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/NestedTypesShouldNotBeVisible.cs index 55e53fff08df..cacdeb61622e 100644 --- a/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/NestedTypesShouldNotBeVisible.cs +++ b/src/Microsoft.CodeAnalysis.NetAnalyzers/src/Microsoft.CodeAnalysis.NetAnalyzers/Microsoft.CodeQuality.Analyzers/ApiDesignGuidelines/NestedTypesShouldNotBeVisible.cs @@ -76,6 +76,12 @@ public override void Initialize(AnalysisContext context) return; } + // Do not report diagnostic for extension members + if (nestedType.TypeKind == ITypeSymbolExtensions.ExtensionTypeKind) + { + return; + } + // The Framework Design Guidelines (see 4.9 Nested Types) say that it is okay // to expose nested types for advanced customization and subclassing scenarios, // so, following FxCop's implementation of this rule, we allow protected and @@ -148,4 +154,4 @@ private static bool IsDataSetSpecialCase( dataRowType != null && nestedTypeBases.Contains(dataRowType); } } -} \ No newline at end of file +}