File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Menees.Analyzers.CodeFixes Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,6 @@ public sealed override Task RegisterCodeFixesAsync(CodeFixContext context)
4949
5050 #region Private Methods
5151
52- [ Browsable ( true ) ]
5352 private static async Task < Document > GetTransformedDocumentAsync (
5453 Document document ,
5554 Diagnostic diagnostic ,
@@ -88,7 +87,7 @@ or SyntaxKind.OutKeyword
8887 . WithAdditionalAnnotations ( Formatter . Annotation ) ;
8988
9089 SyntaxNode newSyntaxRoot = syntaxRoot . ReplaceNode ( oldParameterList , newParameterList ) ;
91- return document . WithSyntaxRoot ( newSyntaxRoot ) ;
90+ result = document . WithSyntaxRoot ( newSyntaxRoot ) ;
9291 }
9392 }
9493
Original file line number Diff line number Diff line change @@ -131,7 +131,8 @@ public void HandleNamedTypeSymbol(SymbolAnalysisContext context)
131131 && ! method . IsOverride
132132 && method . ExplicitInterfaceImplementations . IsDefaultOrEmpty
133133 && ! IsImplicitInterfaceImplementation ( method )
134- && ! settings . IsUnitTestMethod ( method ) )
134+ && ! settings . IsUnitTestMethod ( method )
135+ && ! IsAssemblyEntryPoint ( method , ref context ) )
135136 {
136137 eligibleMethods . Add ( method ) ;
137138
@@ -260,6 +261,14 @@ private bool IsImplicitInterfaceImplementation(IMethodSymbol method)
260261 return result ;
261262 }
262263
264+ private static bool IsAssemblyEntryPoint ( IMethodSymbol method , ref SymbolAnalysisContext context )
265+ {
266+ bool result = method . IsStatic
267+ && method . Name == "Main"
268+ && SymbolComparer . Equals ( method , context . Compilation . GetEntryPoint ( context . CancellationToken ) ) ;
269+ return result ;
270+ }
271+
263272 private bool HasCancellationTokenParameter ( List < IParameterSymbol > parameters )
264273 {
265274 bool result = false ;
You can’t perform that action at this time.
0 commit comments