1
0
mirror of synced 2025-12-19 09:50:46 -05:00
Files
core/release-notes/9.0/preview/preview1/aspnetcore.md
Rich Lander 8c8e5836c3 Fix linter errors in repo (#9689)
* Fix linter errors

* Update links
2025-01-13 21:40:52 -08:00

8.8 KiB

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! ❤️