aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

ASP.NET Core Roadmap for .NET 9

Open mkArtakMSFT opened this issue 1 year ago • 42 comments

This issue represents the list of major investments our team will focus on during the .NET 9 timeframe. It doesn't include all the features and bug fixes we'll be tackling during this time.

Note that this is an aspirational list of what we hope to get to. Many of these items will require thorough investigation and design, which can result in changes to our plans. We'll end up cutting some things and making changes as we go, but we'll try to keep this issue up to date to reflect on our progress and learnings.

There's a lot to discuss in the ASP.NET Core roadmap, and GitHub issue comments aren't great for multi-topic conversations, so we've set up the ASP.NET Core Roadmap for .NET 9 discussion to better handle these threaded conversations.

You can best express your support for specific GitHub issues by giving a 👍 reaction on the original post in the issue and by commenting with details about your scenarios and requirements. We try our best to prioritize work based on broad community support and feedback.

Servers/Scalability

  • https://github.com/dotnet/aspnetcore/issues/53654
  • https://github.com/dotnet/aspnetcore/issues/53255
  • https://github.com/dotnet/aspnetcore/issues/53358

Minimal APIs

  • https://github.com/dotnet/aspnetcore/issues/46349

Blazor

Static Web Assets improvements

  • https://github.com/dotnet/aspnetcore/issues/52824
  • https://github.com/dotnet/aspnetcore/issues/47575
  • https://github.com/dotnet/aspnetcore/issues/47000

Blazor Web improvements

  • https://github.com/dotnet/aspnetcore/issues/49401
  • https://github.com/dotnet/aspnetcore/issues/53129
  • https://github.com/dotnet/aspnetcore/issues/51046
  • https://github.com/dotnet/aspnetcore/issues/51584

Blazor Server improvements

  • https://github.com/dotnet/aspnetcore/issues/35897
  • https://github.com/dotnet/aspnetcore/issues/30344
  • https://github.com/dotnet/aspnetcore/issues/32113
  • https://github.com/dotnet/aspnetcore/issues/29846

Blazor WebAssembly improvements

  • https://github.com/dotnet/aspnetcore/issues/17730

Hot Reload improvements

  • https://github.com/dotnet/aspnetcore/issues/45213
  • https://github.com/dotnet/aspnetcore/issues/52582
  • https://github.com/dotnet/aspnetcore/issues/39765

General Blazor dev experience improvements

  • https://github.com/dotnet/aspnetcore/issues/18088
  • https://github.com/dotnet/aspnetcore/issues/53142
  • https://github.com/dotnet/aspnetcore/issues/26794
  • https://github.com/dotnet/aspnetcore/issues/53215
  • https://github.com/dotnet/aspnetcore/issues/51202
  • https://github.com/dotnet/aspnetcore/issues/26941
  • https://github.com/dotnet/aspnetcore/issues/40190
  • https://github.com/dotnet/aspnetcore/issues/53613
  • https://github.com/dotnet/aspnetcore/issues/51249

mkArtakMSFT avatar Nov 02 '23 21:11 mkArtakMSFT

Ability to run multiple Blazor server / Web assembly apps in the same document (micro-frontends) https://github.com/dotnet/aspnetcore/issues/38128

ghd258 avatar Nov 17 '23 00:11 ghd258

Add validator for Minimal APIs can be great!

Something like this: https://github.com/thisisnabi/Endpoints.FluentValidation

thisisnabi avatar Nov 20 '23 17:11 thisisnabi

I would love to see the ASP.NET session state provider work with InteractiveServer components in Blazor Web so we can share session state across RenderMode boundaries.

gabephudson avatar Dec 02 '23 05:12 gabephudson

I would like to be able to specify a "Static" RenderMode for a Blazor component/page. This is usefull when a global (higher level) RenderMode has been set to InteractiveServer.

gabephudson avatar Dec 02 '23 05:12 gabephudson

@gabephudson

I would like to be able to specify a "Static" RenderMode for a Blazor component/page. This is usefull when a global (higher level) RenderMode has been set to InteractiveServer.

Do you mean that you don't want any interactivity for that specific component in an otherwise interactive component tree?

What benefits or value would that bring to you?

marinasundstrom avatar Dec 02 '23 08:12 marinasundstrom

@ghd258

Ability to run multiple Blazor server / Web assembly apps in the same document (micro-frontends)

That would require to load multiple .NET runtimes within the browser or on the server. The server scenario seems more realistic.

I just can't see how you could even make this a great developer experience.

You are already able to host multiple components on a page, provided that they are in the same app.

marinasundstrom avatar Dec 02 '23 08:12 marinasundstrom

@thisisnabi We're discussing adding data annotations validation support to minimal APIs (via filters): #46349.

For fluent validation, there are much better implementations (e.g.):

  1. https://github.com/Carl-Hugo/FluentValidation.AspNetCore.Http
  2. https://github.com/lucasteles/ValidatedModel.FluentValidation

davidfowl avatar Dec 02 '23 15:12 davidfowl

@gabephudson

I would like to be able to specify a "Static" RenderMode for a Blazor component/page. This is usefull when a global (higher level) RenderMode has been set to InteractiveServer.

Do you mean that you don't want any interactivity for that specific component in an otherwise interactive component tree?

What benefits or value would that bring to you?

Fair question; let me elaborate. This need has been requested frequently in the community as we are upgrading "classic" Blazor apps to the dotnet 8 "Blazor Web" model.

There are several reasons one would want to do this, but the most pervasive today is when one has a Blazor Web application that is primarily an SPA, so one sets "global" interactivity (typically on the Routes component, as in the MS templates), but needs certain pages to render statically.

A good example of this would be the authentication pages, which require access to the HttpContext, need to be static. This cannot currently be achieved (in a "global" interactive app) without having to intercept a path from the HttpContext in app.razor and setting the RenderMode based on the path. In fact, this "hack" is what is being used to force the authentication pages to render statically in the MS Blazor Web Global Interactive Sever template. There are many other scenarios where one would need to "overwrite" a "global RenderMode" to static.

This is important now, because most UI libraries are currently incompatible with the SSR Blazor modes, and porting applications to the Blazor Web model typically requires one to set a global interactive RenderMode for them to continue to function. We would, however, like an easier way to set pages to uses the static mode in these scenarios.

To your point, I think this is much more useful on a per page level component.

Please see this GitHub issue from Daniel Roth... https://github.com/dotnet/aspnetcore/issues/51046

Hopefully this makes it into 9 (or sooner). I think it will really help porting applications and was surprised to find it wasn't included currently. :)

gabephudson avatar Dec 02 '23 18:12 gabephudson

@gabephudson Thanks for clarifying. I agree with you on the problems expressed.

Static rendering did break a lot for me. I have been using MudBlazor, and this library is relying on interactivity, and doesn't work well with SSR. It is OK when you understand the problem and how to solve it. But I think that devs who are not into the mechanics of Blazor would get frustrated.

The SSR story needs to be finished. And it in involves giving guidance to component library authors.

marinasundstrom avatar Dec 02 '23 19:12 marinasundstrom

Give us crystal clear answer if mvc will support aot or not

andrew-vdb avatar Dec 03 '23 18:12 andrew-vdb

Removal of jQuery (maybe bootstrap as well) and revamp of default templates for ASP.NET Core MVC

sanamhub avatar Dec 04 '23 01:12 sanamhub

Make full support for native aot would be nice

sajjadarashhh avatar Dec 05 '23 22:12 sajjadarashhh

Native AOT across the board!

cindro avatar Dec 16 '23 07:12 cindro

I read a lot of requests about making AOT available for the entire framework.

MVC relies heavily on reflection so it is impossible to at least handle every case. Perhaps a source generator could take you a bit farther but there still are considerations, like with Minimal Endpoints.

Perhaps this is something that has to be clarified. What the possible limitations would be.

marinasundstrom avatar Dec 16 '23 12:12 marinasundstrom

Facilitate porting from MVC and Endpoints.

I have been porting from MVC controllers to Minimal API endpoints.

It is a tedious process. Especially with many controllers and actions. Not forgetting that routing and so is slightly different.

I have identified these points:

  • We need a standardized way to group endpoints, similar to that of controllers.

  • Migration path from controller to minimal endpoints: Analyzers and fixers that convert actions to endpoints.

Not for me:

There are requests for AOT in MVC too. But as I understand there are limitations.

Giving devs a migration path would solve that.

I also realize that custom MVC Filters is a potential problem when doing AOT. Especially if there is reflection involved. Types might get trimmed away.

marinasundstrom avatar Dec 16 '23 12:12 marinasundstrom

I'd love to see clarification on what the "modern web stack" is.

If I were to create a greenfield Web API today, I'm assuming Minimal APIs are the way forward; If it weren't for backwards compat, would you have removed Controllers in Asp.Net Core 8¹, or is there still a reason for their continued existence?

Same goes with Web Apps - MVC w/ Razor Views vs Razor Pages vs Blazor SSR / Interactive{Server/WebAssembly}. Is Blazor at a point now where Razor Views and Razor Pages are effectively obsolete? Even explaining the landscape to senior Asp.Net (non-Core) developers is complicated (Largely due to the confusing naming convention :shrug:), let alone junior developers.

I've seen some statements on the Blazor topic in particular (https://github.com/dotnet/aspnetcore/issues/50999#issuecomment-1740016883), but that's just some guy ², and even then it's only a recommendation. I've yet to see anything equivalent in the API world.

¹ The reason I say Asp.Net Core 8 is the fact that (I think) it added the last feature that was missing - forms - but I'm sure there are other minor features missing as well.

² I realize that he's the product manager for Blazor, but I can't tell my team to stop using MVC simply by pointing to a random comment in a GitHub issue - no matter how important the author is.

KennethHoff avatar Dec 17 '23 15:12 KennethHoff

I have to echo the need for fine-grained interactivity. A constant problem we're facing is we have components that really should only function client-side, like trigger a menu or something, and with ServerInteractive each one of these requires a roundtrip to the server. Switching them to WASM is not possible because then that entire page has to be WASM, and we simply don't have any pages that have zero interactivity.

The other option is to forget about server interactivity and do the whole thing in WASM. But then we have to introduce Controllers/Minimal-Endpoints and manage those.

One of the huge benefits of server interactivity is no longer needing to manage endpoints. And also if a button calls a function I can cmd+click that function and go directly to the code. Full WASM breaks all of that.

Another issue is that the SignalR connection is simply not that reliable. Chrome shuts it off in the background, iOS shuts it off in the background. We constantly have to deal with the Server Reconnect screen. We can hide it, but then we have issues with a random button that's supposed to toggle a menu not working when really that doesn't even truly need a server roundtrip.

Johnhersh avatar Dec 21 '23 14:12 Johnhersh

Would love to know when the page is prerendering so we don't run database calls twice. Such an oversight with the way blazor works.

KonnectSalon avatar Jan 09 '24 02:01 KonnectSalon

@KonnectSalon Yes. That is probably something that you want out of the box: Knowing where and how the component is being rendered.

However, I solve it with this simple service:

https://github.com/marinasundstrom/Blazor8Test/blob/main/src/Server/ServerRenderingContext.cs

There is a Client version, of course.

marinasundstrom avatar Jan 10 '24 00:01 marinasundstrom

The SignalR client source generator needs to be officially released.

Also, we need to investigate what to do on server-side.

Given the strongly-typed Hub Client interface:

public interface ITodosClient
{
    Task TodoCreated(TodoDto todo);
}

This is what I currently do on server-side:

public sealed class TodosClient(IHubContext<TodosHub, ITodosClient> hubContext) : ITodosClient
{
    public async Task TodoCreated(TodoDto todo)
    {
        await hubContext.Clients.All.TodoCreated(todo);
    }
}
public sealed class TodoCreatedHandler(
    ITodoRepository todoRepository, ITodosClient todosClient) : IDomainEventHandler<TodoCreated>
{
    public async Task Handle(TodoCreated notification, CancellationToken cancellationToken)
    {
        var todo = await todoRepository.FindByIdAsync(notification.TodoId, cancellationToken);

        if (todo is null)
        {
            throw new Exception();
        }

        await todosClient.TodoCreated(todo.ToDto());
    }
}

Although this is trivial to implement, I would suggest a source gen for this, but that would ignore the fact that you need to able to control what clients or groups will receive the call.

You could perhaps control some of this through additional attributes. But is most likely not worth the effort.

At least, there should be guidance on this.

marinasundstrom avatar Jan 13 '24 10:01 marinasundstrom

On InteractiveServer, I would love to see IServiceCollection AddComponentized<TService, TImplementation> (Ok, I'm not great with names.)

In Blazor InterctiveServer, a scoped service is tied to the user's SignalR lifetime. This causes grief for libraries like EFCore, where one often wants it tied to the razor page's (component) lifecycle, not SignalR. The result is a factory with extra code, extra disposal calls, and it feels only natural that DI could handle this a lot better with the right scope.

ssnseawolf avatar Jan 24 '24 16:01 ssnseawolf

Is Blazor at a point now where Razor Views and Razor Pages are effectively obsolete?

@KennethHoff Blazor is now our recommended approach for building web UI with ASP.NET Core, but neither MVC nor Razor Pages are now obsolete. Both MVC & Razor Pages are mature, fully supported, and widely used frameworks that we plan to support for the foreseeable future. There is also no requirement or guidance to migrate existing MVC or Razor Pages apps to Blazor. For existing, well-established MVC-based projects, continuing to develop with MVC is a perfectly valid and reasonable approach. If you want to use Blazor components in your MVC or Razor Pages apps there are various approach to doing so.

danroth27 avatar Jan 27 '24 18:01 danroth27

Thanks everyone for sharing your feedback so far on the ASP.NET Core Roadmap for .NET 9 (in spite of it being completely empty currently 😆). More details on the proposed roadmap will be coming soon!

A couple of tips to make this discussion as productive as possible:

  • Please make sure any ideas or suggestions you have are tracked by specific GitHub issues. If it's not tracked by an issue, then it almost certainly won't get done!
  • You can express your support for specific GitHub issues by giving a 👍 reaction on the original post in the issue and by commenting with details about your scenarios and requirements. We try our best to prioritize work based on broad community support and feedback.
  • There's a lot to discuss in the ASP.NET Core roadmap, and GitHub issue comments aren't great for multi-topic conversations, so we've set up the ASP.NET Core Roadmap for .NET 9 discussion to better handle these threaded conversations.

Thanks again for helping out with the .NET 9 release! Your feedback and insights are critical to ensure we keep moving web development with .NET forward in the best possible way.

danroth27 avatar Jan 27 '24 18:01 danroth27

I would love to see the ASP.NET session state provider work with InteractiveServer components in Blazor Web so we can share session state across RenderMode boundaries.

@gabephudson Could you please open a GitHub issue to propose this new functionality and provide details on your scenarios and requirements for this feature?

danroth27 avatar Jan 27 '24 18:01 danroth27

The SSR story needs to be finished.

@marinasundstrom It would be great if you could share what you see as the remaining work here! We're trying to make sure any remaining gaps in the Blazor state SSR support are tracked and prioritized.

And it in involves giving guidance to component library authors.

I 100% agree we need to do a better job at providing guidance for component library authoring. I've opened https://github.com/dotnet/AspNetCore.Docs/issues/31591 to track this.

danroth27 avatar Jan 27 '24 18:01 danroth27

Would love to know when the page is prerendering so we don't run database calls twice. Such an oversight with the way blazor works.

@KonnectSalon I believe this is tracked by https://github.com/dotnet/aspnetcore/issues/49401.

danroth27 avatar Jan 27 '24 18:01 danroth27

On InteractiveServer, I would love to see IServiceCollection AddComponentized<TService, TImplementation> (Ok, I'm not great with names.)

@ssnseawolf You should probably open a GitHub issue to propose this API and clarify what you expect it to do and why.

In Blazor InterctiveServer, a scoped service is tied to the user's SignalR lifetime. This causes grief for libraries like EFCore, where one often wants it tied to the razor page's (component) lifecycle, not SignalR. The result is a factory with extra code, extra disposal calls, and it feels only natural that DI could handle this a lot better with the right scope.

@ssnseawolf Blazor does provide a number of DI utility features to help manage interactions with EF Core. If you haven't already, please take a look at the related docs and see if it helps: https://learn.microsoft.com/aspnet/core/blazor/fundamentals/dependency-injection#utility-base-component-classes-to-manage-a-di-scope

danroth27 avatar Jan 27 '24 19:01 danroth27

Another issue is that the SignalR connection is simply not that reliable.

@Johnhersh We are tracking a number of issues related to this problem with interactive server rendering connectivity management that you can express your support for:

  • #32113
  • #30344

danroth27 avatar Jan 27 '24 19:01 danroth27

Facilitate porting from MVC and Endpoints. I have been porting from MVC controllers to Minimal API endpoints. It is a tedious process. Especially with many controllers and actions.

@marinasundstrom You might be able to automatic this by writing a .NET Upgrade Assistant extension.

danroth27 avatar Jan 27 '24 19:01 danroth27

Make full support for native aot would be nice Give us crystal clear answer if mvc will support aot or not

@sajjadarashhh @andrew-vdb @cindro We expect to make progress investigating Native AOT support for MVC & Blazor in the .NET 9 timeframe, but we don't expect to deliver production ready Native AOT support for .NET 9 given the large amount of work involved.

Related issues:

  • https://github.com/dotnet/aspnetcore/issues/51598
  • https://github.com/dotnet/aspnetcore/issues/53667

danroth27 avatar Jan 27 '24 19:01 danroth27