-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
DoneThis issue has been fixedThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templateshelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issuetask
Milestone
Description
When looking at the Razor layouts that are included in the standard templates, why do they use the synchronous method RenderSection instead of the asynchronous RenderSectionAsync?
Looking at the implementation of RenderSection, it will actually block using an awaiter:
var task = RenderSectionAsyncCore(name, required);
return task.GetAwaiter().GetResult();That seems to be an odd preference to make in the default templates.
I understand that it may look somewhat verbose to do @await RenderSectionAsync("foo") instead of just @RenderSection("foo") but if there was no difference, then what would be the point of the async method? And while the Script sections probably won’t contain that much content, showing users how to do it “properly” would probably still be a good thing to do.
mauler2025
Metadata
Metadata
Assignees
Labels
DoneThis issue has been fixedThis issue has been fixedarea-mvcIncludes: MVC, Actions and Controllers, Localization, CORS, most templatesIncludes: MVC, Actions and Controllers, Localization, CORS, most templateshelp wantedUp for grabs. We would accept a PR to help resolve this issueUp for grabs. We would accept a PR to help resolve this issuetask