From 2d3398ef1c0774ea38e61c6b59696471862d3827 Mon Sep 17 00:00:00 2001 From: Will Smith Date: Mon, 11 Jul 2022 14:16:18 -0700 Subject: [PATCH 1/2] ILASM - Allow EntryPoint methods to be on interfaces --- src/coreclr/ilasm/assem.cpp | 2 -- .../coreclr/Runtime_49998/Runtime_49998.cs | 12 ++++++++++++ .../coreclr/Runtime_49998/Runtime_49998.csproj | 8 ++++++++ 3 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs create mode 100644 src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.csproj diff --git a/src/coreclr/ilasm/assem.cpp b/src/coreclr/ilasm/assem.cpp index e58b8e569d8d3..c4b8c6aea0e45 100644 --- a/src/coreclr/ilasm/assem.cpp +++ b/src/coreclr/ilasm/assem.cpp @@ -725,8 +725,6 @@ BOOL Assembler::EmitMethod(Method *pMethod) //-------------------------------------------------------------------------------- if (pMethod->m_fEntryPoint) { - if(fIsInterface) report->error("Entrypoint in Interface: Method '%s'\n",pszMethodName); - if (FAILED(m_pCeeFileGen->SetEntryPoint(m_pCeeFile, MethodToken))) { report->error("Failed to set entry point for method '%s'\n",pszMethodName); diff --git a/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs b/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs new file mode 100644 index 0000000000000..36cd7dda74110 --- /dev/null +++ b/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs @@ -0,0 +1,12 @@ +using System; + +namespace InterfaceMain +{ + interface Program + { + static void Main(string[] args) + { + Console.WriteLine("Hello World!"); + } + } +} \ No newline at end of file diff --git a/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.csproj b/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.csproj new file mode 100644 index 0000000000000..cfd28390d749f --- /dev/null +++ b/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.csproj @@ -0,0 +1,8 @@ + + + Exe + + + + + \ No newline at end of file From 3b56542bfe2e39e147eef88ff5113d7a178df17c Mon Sep 17 00:00:00 2001 From: Will Smith Date: Tue, 12 Jul 2022 16:10:13 -0700 Subject: [PATCH 2/2] Update Runtime_49998.cs --- .../Regressions/coreclr/Runtime_49998/Runtime_49998.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs b/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs index 36cd7dda74110..2fabef2dcef11 100644 --- a/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs +++ b/src/tests/Regressions/coreclr/Runtime_49998/Runtime_49998.cs @@ -4,9 +4,9 @@ namespace InterfaceMain { interface Program { - static void Main(string[] args) + static int Main(string[] args) { - Console.WriteLine("Hello World!"); + return 100; } } -} \ No newline at end of file +}