Since .net core 3.0 is going to introduce first stable Blazor release and C# 8 I think that it would be a good idea to make Blazor samples already use latest incarnation of the language.
This would nicely go in tandem I think, and would already provide best practices.
All Blazor code is going to be new code and using nullable references is mentioned to be the preferred way of writing new code in Microsoft's official communication.
Right now, when C# 8 and nullable references are turned on, the compiler throws a bunch of warnings.
UserInfo.cs(7,23): warning CS8618: Non-nullable property 'Name' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Address.cs(10,23): warning CS8618: Non-nullable property 'Name' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Address.cs(13,23): warning CS8618: Non-nullable property 'Line1' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Address.cs(16,23): warning CS8618: Non-nullable property 'Line2' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Address.cs(19,23): warning CS8618: Non-nullable property 'City' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Address.cs(22,23): warning CS8618: Non-nullable property 'Region' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Address.cs(25,23): warning CS8618: Non-nullable property 'PostalCode' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Topping.cs(7,23): warning CS8618: Non-nullable property 'Name' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
PizzaTopping.cs(5,24): warning CS8618: Non-nullable property 'Topping' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
PizzaSpecial.cs(10,23): warning CS8618: Non-nullable property 'Name' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
PizzaSpecial.cs(14,23): warning CS8618: Non-nullable property 'Description' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
PizzaSpecial.cs(16,23): warning CS8618: Non-nullable property 'ImageUrl' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
OrderWithStatus.cs(9,22): warning CS8618: Non-nullable property 'Order' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
OrderWithStatus.cs(11,23): warning CS8618: Non-nullable property 'StatusText' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
OrderWithStatus.cs(13,29): warning CS8618: Non-nullable property 'MapMarkers' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Pizza.cs(19,29): warning CS8618: Non-nullable property 'Special' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Pizza.cs(25,35): warning CS8618: Non-nullable property 'Toppings' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Order.cs(11,23): warning CS8618: Non-nullable property 'UserId' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
Order.cs(17,24): warning CS8618: Non-nullable property 'DeliveryLocation' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Shared\BlazingPizza.Shared.csproj]
OrderState.cs(28,32): warning CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Client\BlazingPizza.Client.csproj]
OrderState.cs(36,32): warning CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Client\BlazingPizza.Client.csproj]
OrderState.cs(9,22): warning CS8618: Non-nullable property 'ConfiguringPizza' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Client\BlazingPizza.Client.csproj]
OrderState.cs(28,32): warning CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Client\BlazingPizza.Client.csproj]
OrderState.cs(36,32): warning CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Client\BlazingPizza.Client.csproj]
OrderState.cs(9,22): warning CS8618: Non-nullable property 'ConfiguringPizza' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Client\BlazingPizza.Client.csproj]
PizzaStoreContext.cs(7,16): warning CS8618: Non-nullable property 'Orders' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(7,16): warning CS8618: Non-nullable property 'Pizzas' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(7,16): warning CS8618: Non-nullable property 'Specials' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(7,16): warning CS8618: Non-nullable property 'Toppings' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(11,16): warning CS8618: Non-nullable property 'Orders' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(11,16): warning CS8618: Non-nullable property 'Pizzas' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(11,16): warning CS8618: Non-nullable property 'Specials' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
PizzaStoreContext.cs(11,16): warning CS8618: Non-nullable property 'Toppings' is uninitialized. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
OrdersController.cs(68,35): warning CS8602: Dereference of a possibly null reference. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
OrdersController.cs(69,33): warning CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
OrdersController.cs(73,41): warning CS8602: Dereference of a possibly null reference. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
OrdersController.cs(74,39): warning CS8625: Cannot convert null literal to non-nullable reference type. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
OrdersController.cs(86,20): warning CS8603: Possible null reference return. [C:\Users\mikom\Documents\Projects\blazor\blazor-workshop\src\BlazingPizza.Server\BlazingPizza.Server.csproj]
Hello,
Since .net core 3.0 is going to introduce first stable Blazor release and C# 8 I think that it would be a good idea to make Blazor samples already use latest incarnation of the language.
This would nicely go in tandem I think, and would already provide best practices.
All Blazor code is going to be new code and using nullable references is mentioned to be the preferred way of writing new code in Microsoft's official communication.
Right now, when C# 8 and nullable references are turned on, the compiler throws a bunch of warnings.