Separate IResult based results from ActionResults#33843
Conversation
|
Why a new assembly? |
|
The results depend on M.A.Routing which adds a circular dependency if they are in M.A.H.Extensions. |
|
|
||
| public Task ExecuteAsync(HttpContext httpContext) | ||
| { | ||
| var loggerFactory = httpContext.RequestServices.GetRequiredService<ILoggerFactory>(); |
There was a problem hiding this comment.
We're going to want to cache these calls to the logger, but that should be in another PR. My guess is that we haven't looked at this cost in MVC.
| private static Action<ILogger, StringValues, string, Exception?> _copyingFileRange; | ||
| private static Action<ILogger, Exception?> _writeCancelled; | ||
| private static Action<ILogger, Exception?> _endpointMatched; | ||
| private static readonly Action<ILogger, string, Exception?> _methodNotSupported; |
There was a problem hiding this comment.
It's this analyzer - which is a suggestion, but shows up as warnings in VS: https://github.com/dotnet/aspnetcore/blob/main/.editorconfig#L100-L101. Source generator to happen separately.
| /// <summary> | ||
| /// Creates a <see cref="ChallengeResult"/>. | ||
| /// </summary> | ||
| /// <returns>The created <see cref="ChallengeResult"/> for the response.</returns> |
There was a problem hiding this comment.
Is it OK to refer to internal types in these public doc comments? What happens when API doc is generated?
There was a problem hiding this comment.
The API docs will referer to the type full name, and completion colorizes it correctly, but you're not able to control click on the type to get there. Not super weird. I didn't change the doc comments much as I mas transferring them from MVC, but if you feel strongly about it, I can do a pass to clean it up.
| /// Creates a <see cref="AcceptedResult"/> object that produces an <see cref="StatusCodes.Status202Accepted"/> response. | ||
| /// </summary> | ||
| /// <param name="uri">The optional URI with the location at which the status of requested content can be monitored. | ||
| /// May be null.</param> |
There was a problem hiding this comment.
We're not consistent with how we document nullable ref types in params. Some are 'blah blah; may be null', others are like this one. Let's just pick one form and stick with it.
| /// <summary> | ||
| /// Creates a <see cref="AcceptedResult"/> object that produces an <see cref="StatusCodes.Status202Accepted"/> response. | ||
| /// </summary> | ||
| /// <param name="value">The optional content value to format in the entity body; may be null.</param> |
There was a problem hiding this comment.
Might 'response body' be clearer language than 'entity body'?
There was a problem hiding this comment.
Sure. I think this comment might have been from WebAPI2 which tends to use the RFC names
| string contentType, | ||
| string? fileDownloadName, | ||
| bool enableRangeProcessing) | ||
| => new PhysicalFileResult(physicalPath, contentType) |
There was a problem hiding this comment.
Curious, why is this one expression bodied but the next one not?
There was a problem hiding this comment.
Somebody forgot to update MVC: https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.Core/src/ControllerBase.cs#L1647-L1677
803688f to
025962d
Compare
025962d to
7d22183
Compare
|
@pranavkm can you make one of the samples use these? |
|
Curious: I skimmed the projects but couldn't find a reference to the new project. Other than the samples @davidfowl suggested, where will the assembly be used❔ |
|
@dougbu the plan is to use these in the minimal actions project template. I updated a functional test to use some of these result types. |
Co-authored-by: Martin Costello <martin@martincostello.com>
3244ce7 to
b330b73
Compare
Fixes #33729