Skip to content

Latest commit

 

History

History
139 lines (117 loc) · 8.8 KB

aspnetcore.md

File metadata and controls

139 lines (117 loc) · 8.8 KB

ASP.NET Core in .NET 9 Preview 1 Release Notes

Here's a summary of what's new in ASP.NET Core in this preview release:

  • Dictionary debugging improvements
  • JSON polymorphic type support in SignalR Hubs
  • General quality improvements and bug fixes

ASP.NET Core updates in .NET 9 Preview 1:

.NET 9 Preview 1:

Dictionary debugging improvements

The debugging display of dictionaries and other key-value collections has an improved layout. The key is displayed in the debugger's key column instead of being concatenated with the value. The following images show the old and new display of a dictionary in the debugger.

Before:

Prior experience debugging dictionaries.

After:

New experience debugging dictionaries.

ASP.NET Core has many key-value collections. This improved debugging experience applies to:

  • HTTP headers
  • Query strings
  • Forms
  • Cookies
  • View data
  • Route data
  • Features

JSON polymorphic type support in SignalR Hubs

Hub methods can now accept a base class instead of the derived class to enable polymorphic scenarios. The base type needs to be annotated to allow polymorphism.

public class MyHub : Hub
{
    public void Method(JsonPerson person)
    {
        if (person is JsonPersonExtended)
        {
        }
        else if (person is JsonPersonExtended2)
        {
        }
        else
        {
        }
    }
}

[JsonPolymorphic]
[JsonDerivedType(typeof(JsonPersonExtended), nameof(JsonPersonExtended))]
[JsonDerivedType(typeof(JsonPersonExtended2), nameof(JsonPersonExtended2))]
private class JsonPerson
{
    public string Name { get; set; }
    public Person Child { get; set; }
    public Person Parent { get; set; }
}

private class JsonPersonExtended : JsonPerson
{
    public int Age { get; set; }
}

private class JsonPersonExtended2 : JsonPerson
{
    public string Location { get; set; }
}

Community contributors

Thank you contributors! ❤️