dotnet/roslyn

Main Method warnings are ignored if "main type" is specified

Open

#18.964 geöffnet am 24. Apr. 2017

Auf GitHub ansehen
 (9 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)C# (4.257 Forks)batch import
Area-CompilersBugConcept-Diagnostic Clarityhelp wanted

Repository-Metriken

Stars
 (20.414 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 5T 21h) (286 gemergte PRs in 30 T)

Beschreibung

In the CSharp entrypoint finder warnings that would otherwise be reported are simply ignored if a Main Type is provided to the compiler.

Example

static class Program {
    static void Main<T>() { }
    static void Main(string[] args) { }
}

compiling with csc /main:Program repro.cs produces no errors or diagnostics

compiling with csc repro.cs gives you:

repro.cs(2,17): warning CS0402: 'Program.Main<T>()': an entry point cannot be generic or in a generic type

Contributor Guide