dotnet/roslyn

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

オープン

#18,964 opened on 2017/04/24

 (9 件のコメント) (0 件のリアクション) (0 人の担当者)C# (4,257 件のフォーク)batch import
Area-CompilersBugConcept-Diagnostic Clarityhelp wanted

Repository metrics

Stars
 (20,414 個のスター)
PR merge metrics
 (平均マージ 6d 17h) (30d で 256 merged PRs)

説明

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

コントリビューターガイド