No more public partial class Program in .NET 10

11/19/2025
1 minute read

If you are using API Tests with the WebApplicationFactory you might did something like this to have a public Program class:

public partial class Program;

No more!

.NET 10

If you used the WebApplicationFactory, you somewhere had something like: WebApplicationFactory<Program> and if you used top-level statements, you needed to declare the Program class as public partial otherwise it was internal by default.

But that changed with .NET 10. Now the Program class is always public, so you don't need to declare it anymore.

There is now even an analyzer ASP0027.

An error has occurred. This application may no longer respond until reloaded. Reload x