Skip to content

Commit

Permalink
Update testAppsTopLevel.md (#34763)
Browse files Browse the repository at this point in the history
* Update testAppsTopLevel.md

Fixes #34725

* Update aspnetcore/release-notes/aspnetcore-10/includes/testAppsTopLevel.md

* Update link for 'internal' keyword reference
  • Loading branch information
Rick-Anderson authored Feb 19, 2025
1 parent 07969bc commit e99e04d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
### Better support for testing apps with top-level statements

.NET 10 now has better support for testing apps that use top-level statements. Previously developers had to manually add `public partial class Program` to the `Program.cs` file so that the test project could reference the `Program class`. This is because the top-level statement feature in C# 9 generated a `Program class` that was declared as internal.
.NET 10 now has better support for testing apps that use [top-level statements](/dotnet/csharp/fundamentals/program-structure/top-level-statements). Previously developers had to manually add `public partial class Program` to the `Program.cs` file so that the test project could reference the `Program class`. `public partial class Program` was required because the top-level statement feature in C# 9 generated a `Program class` that was declared as [internal](/dotnet/csharp/language-reference/keywords/internal).

In .NET 10, a source generator is used to generate the `public partial class Program` declaration if the programmer did not declare it explicitly. In addition, an analyzer was added to detect when `public partial class Program` is declared explicitly and advise the developer to remove it.
In .NET 10, a [source generator](/shows/on-dotnet/c-source-generators) is used to generate the `public partial class Program` declaration if the programmer didn't declare it explicitly. Additionally, an analyzer was added to detect when `public partial class Program` is declared explicitly and advise the developer to remove it.

![Image](https://github.com/user-attachments/assets/a37f0c81-a58a-453f-8da5-fa49356ca180)

Expand Down

0 comments on commit e99e04d

Please sign in to comment.