Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ private static void OnCompilationStart(CompilationStartAnalysisContext context)
!type.IsStatic &&
!type.IsSealed &&
!type.IsExternallyVisible() &&
!type.HasAttribute(comImportAttributeType))
!type.HasAttribute(comImportAttributeType) &&
!type.IsTopLevelStatementsEntryPointType())
{
candidateTypes.Add(type);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
using Test.Utilities;
using Xunit;

using VerifyCS = Test.Utilities.CSharpCodeFixVerifier<
Expand Down Expand Up @@ -202,6 +203,20 @@ End Class
#endregion

#region No Diagnostic
[Fact, WorkItem(6141, "https://github.com/dotnet/roslyn-analyzers/issues/6141")]
public Task TopLevelStatementsProgram()
{
return new VerifyCS.Test()
{
TestState =
{
Sources = { "System.Console.WriteLine();" },
OutputKind = OutputKind.ConsoleApplication,
},
LanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp9,
}.RunAsync();
}

[Fact]
public Task PublicClassType_NoDiagnostic_CS()
{
Expand Down