From d9d8df079f7247137e15e725649a4bd5b9f29551 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 11 Oct 2021 08:20:26 -0500 Subject: [PATCH 1/5] NRTs and .NET compiler null-state static analysis --- aspnetcore/blazor/project-structure.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index 08fb602e2858..422bf758d094 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -96,6 +96,20 @@ The Blazor Server template creates the initial files and directory structure for * is called to set up an endpoint for the real-time connection with the browser. The connection is created with [SignalR](xref:signalr/introduction), which is a framework for adding real-time web functionality to apps. * [`MapFallbackToPage("/_Host")`](xref:Microsoft.AspNetCore.Builder.RazorPagesEndpointRouteBuilderExtensions.MapFallbackToPage%2A) is called to set up the root page of the app (`Pages/_Host.cshtml`) and enable navigation. +## Nullable reference types (NRTs) and .NET compiler null-state static analysis + +Blazor project templates embrace the use of nullable reference types (NRTs) and the .NET compiler's null-state static analysis. These features were first available with the release of C# 8 and are enabled by default for apps generated using ASP.NET Core 6.0 (C# 10) or later. + +.NET compiler null-state warnings can either be ignored or serve as a guide for the developer to update an example or sample app locally. You can also disable the compiler's null-state static analysis by setting `Nullable` to `disable` in the app's project file, which we only recommend for documentation examples. **_We don't recommended disabling null-state checking in production projects._** + +For more information on NRTs, the MSBuild `Nullable` property, and updating apps (including `#pragma` guidance), see the following resources in the C# documentation: + +* [Nullable reference types](/dotnet/csharp/nullable-references) +* [Nullable reference types (C# reference)](/dotnet/csharp/language-reference/builtin-types/nullable-reference-types) +* [Learn techniques to resolve nullable warnings](/dotnet/csharp/nullable-warnings) +* [Update a codebase with nullable reference types to improve null diagnostic warnings](/dotnet/csharp/nullable-migration-strategies) +* [Attributes for null-state static analysis](/dotnet/csharp/language-reference/attributes/nullable-analysis) + ## Additional resources * From d33b4dd3116454342e556564aee5715336d1fdfc Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 11 Oct 2021 08:30:56 -0500 Subject: [PATCH 2/5] Updates --- aspnetcore/blazor/project-structure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index 422bf758d094..7ae96be85ee7 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -100,7 +100,7 @@ The Blazor Server template creates the initial files and directory structure for Blazor project templates embrace the use of nullable reference types (NRTs) and the .NET compiler's null-state static analysis. These features were first available with the release of C# 8 and are enabled by default for apps generated using ASP.NET Core 6.0 (C# 10) or later. -.NET compiler null-state warnings can either be ignored or serve as a guide for the developer to update an example or sample app locally. You can also disable the compiler's null-state static analysis by setting `Nullable` to `disable` in the app's project file, which we only recommend for documentation examples. **_We don't recommended disabling null-state checking in production projects._** +.NET compiler null-state warnings can either be ignored or serve as a guide for the developer to update an example or sample app locally. You can also disable the compiler's null-state static analysis by setting `Nullable` to `disable` in the app's project file, which we only recommend for documentation examples and sample apps. **_We don't recommended disabling null-state checking in production projects._** For more information on NRTs, the MSBuild `Nullable` property, and updating apps (including `#pragma` guidance), see the following resources in the C# documentation: From 4f988f071ec2ba58916f4a90375ac85e6e57e0be Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 11 Oct 2021 08:35:35 -0500 Subject: [PATCH 3/5] Updates --- aspnetcore/blazor/project-structure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index 7ae96be85ee7..8a17cb174241 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -100,7 +100,7 @@ The Blazor Server template creates the initial files and directory structure for Blazor project templates embrace the use of nullable reference types (NRTs) and the .NET compiler's null-state static analysis. These features were first available with the release of C# 8 and are enabled by default for apps generated using ASP.NET Core 6.0 (C# 10) or later. -.NET compiler null-state warnings can either be ignored or serve as a guide for the developer to update an example or sample app locally. You can also disable the compiler's null-state static analysis by setting `Nullable` to `disable` in the app's project file, which we only recommend for documentation examples and sample apps. **_We don't recommended disabling null-state checking in production projects._** +.NET compiler null-state warnings can either be ignored or serve as a guide for the developer to update an example or sample app locally. You can also disable the compiler's null-state static analysis by [setting `Nullable` to `disable`](/dotnet/csharp/language-reference/builtin-types/nullable-reference-types#setting-the-nullable-context) in the app's project file, which we only recommend for documentation examples and sample apps. **_We don't recommended disabling null-state checking in production projects._** For more information on NRTs, the MSBuild `Nullable` property, and updating apps (including `#pragma` guidance), see the following resources in the C# documentation: From 21b6b0bc606da2b0fc90708e56ac6971d44bf4d8 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 11 Oct 2021 08:37:55 -0500 Subject: [PATCH 4/5] Updates --- aspnetcore/blazor/project-structure.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index 8a17cb174241..0d3e0ea2fc3c 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -100,7 +100,7 @@ The Blazor Server template creates the initial files and directory structure for Blazor project templates embrace the use of nullable reference types (NRTs) and the .NET compiler's null-state static analysis. These features were first available with the release of C# 8 and are enabled by default for apps generated using ASP.NET Core 6.0 (C# 10) or later. -.NET compiler null-state warnings can either be ignored or serve as a guide for the developer to update an example or sample app locally. You can also disable the compiler's null-state static analysis by [setting `Nullable` to `disable`](/dotnet/csharp/language-reference/builtin-types/nullable-reference-types#setting-the-nullable-context) in the app's project file, which we only recommend for documentation examples and sample apps. **_We don't recommended disabling null-state checking in production projects._** +The .NET compiler's null-state static analysis warnings can either be ignored or serve as a guide for updating a documentation example or sample app locally. Null-state static analysis can be disabled by [setting `Nullable` to `disable`](/dotnet/csharp/language-reference/builtin-types/nullable-reference-types#setting-the-nullable-context) in the app's project file, which we only recommend for documentation examples and sample apps. **_We don't recommended disabling null-state checking in production projects._** For more information on NRTs, the MSBuild `Nullable` property, and updating apps (including `#pragma` guidance), see the following resources in the C# documentation: From 4b94e8c49fb8362499cd689403c0f11094b01ef4 Mon Sep 17 00:00:00 2001 From: guardrex <1622880+guardrex@users.noreply.github.com> Date: Mon, 11 Oct 2021 08:48:10 -0500 Subject: [PATCH 5/5] Updates --- aspnetcore/blazor/project-structure.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aspnetcore/blazor/project-structure.md b/aspnetcore/blazor/project-structure.md index 0d3e0ea2fc3c..01b685b74bc3 100644 --- a/aspnetcore/blazor/project-structure.md +++ b/aspnetcore/blazor/project-structure.md @@ -98,9 +98,9 @@ The Blazor Server template creates the initial files and directory structure for ## Nullable reference types (NRTs) and .NET compiler null-state static analysis -Blazor project templates embrace the use of nullable reference types (NRTs) and the .NET compiler's null-state static analysis. These features were first available with the release of C# 8 and are enabled by default for apps generated using ASP.NET Core 6.0 (C# 10) or later. +Blazor project templates embrace the use of nullable reference types (NRTs) and the .NET compiler's null-state static analysis. These features were released with C# 8 and are enabled by default for apps generated using ASP.NET Core 6.0 (C# 10) or later. -The .NET compiler's null-state static analysis warnings can either be ignored or serve as a guide for updating a documentation example or sample app locally. Null-state static analysis can be disabled by [setting `Nullable` to `disable`](/dotnet/csharp/language-reference/builtin-types/nullable-reference-types#setting-the-nullable-context) in the app's project file, which we only recommend for documentation examples and sample apps. **_We don't recommended disabling null-state checking in production projects._** +The .NET compiler's null-state static analysis warnings can either be ignored or serve as a guide for updating a documentation example or sample app locally. Null-state static analysis can be disabled by [setting `Nullable` to `disable`](/dotnet/csharp/language-reference/builtin-types/nullable-reference-types#setting-the-nullable-context) in the app's project file, which we only recommend for documentation examples and sample apps if the compiler warnings are distracting while learning about .NET. **_We don't recommended disabling null-state checking in production projects._** For more information on NRTs, the MSBuild `Nullable` property, and updating apps (including `#pragma` guidance), see the following resources in the C# documentation: