We'll treat this as a bug (not a language feature) and document the breaking change.
Top-level statements will be emitted into a type named Program:
partial class Program
{
public static ... <Main>$(...)
{
/* top-level statements */
}
}
https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-07-12.md#speakable-names-for-top-level-statements
Motivating scenario from ASP.NET:
//Test Application (xunit for example):
[Fact]
public async Task HelloWorld()
{
var webApplicationFactory = new WebApplicationFactory<Program>(); // type -> assembly -> entry point
var content = await webApplicationFactory.Client.GetStringAsync(http://localhost/);
Assert.Equal("Hello World", content);
}
We'll treat this as a bug (not a language feature) and document the breaking change.
Top-level statements will be emitted into a type named
Program:https://github.com/dotnet/csharplang/blob/main/meetings/2021/LDM-2021-07-12.md#speakable-names-for-top-level-statements
Motivating scenario from ASP.NET: