Skip to content

Commit 5919948

Browse files
committed
Feedback
1 parent 14d6962 commit 5919948

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public static IApplicationBuilder UseExceptionHandler(this IApplicationBuilder a
6262
return app.UseExceptionHandler(new ExceptionHandlerOptions
6363
{
6464
ExceptionHandlingPath = new PathString(errorHandlingPath),
65-
UseNewServiceResolutionScope = newScope
65+
CreateScopeForErrors = newScope
6666
});
6767
}
6868

src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerMiddlewareImpl.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@ private async Task HandleException(HttpContext context, ExceptionDispatchInfo ed
143143
{
144144
context.Request.Path = _options.ExceptionHandlingPath;
145145
}
146-
var oldScope = _options.UseNewServiceResolutionScope ? context.RequestServices : null;
147-
using var scope = _options.UseNewServiceResolutionScope ? context.RequestServices.GetRequiredService<IServiceScopeFactory>().CreateScope() : null;
146+
var oldScope = _options.CreateScopeForErrors ? context.RequestServices : null;
147+
using var scope = _options.CreateScopeForErrors ? context.RequestServices.GetRequiredService<IServiceScopeFactory>().CreateScope() : null;
148148

149149
try
150150
{

src/Middleware/Diagnostics/src/ExceptionHandler/ExceptionHandlerOptions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ public class ExceptionHandlerOptions
1919

2020
/// <summary>
2121
/// Gets or sets whether the handler needs to create a separate <see cref="IServiceProvider"/> scope and
22-
/// replace it on <see cref="HttpContext"/>.
22+
/// replace it on <see cref="HttpContext.RequestServices"/> when re-executing the request to handle an error.
2323
/// </summary>
2424
/// <remarks>The default value is <see langword="false"/>.</remarks>
25-
public bool UseNewServiceResolutionScope { get; set; }
25+
public bool CreateScopeForErrors { get; set; }
2626

2727
/// <summary>
2828
/// The <see cref="RequestDelegate" /> that will handle the exception. If this is not

src/Middleware/Diagnostics/src/PublicAPI.Unshipped.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#nullable enable
2-
Microsoft.AspNetCore.Builder.ExceptionHandlerOptions.UseNewServiceResolutionScope.get -> bool
3-
Microsoft.AspNetCore.Builder.ExceptionHandlerOptions.UseNewServiceResolutionScope.set -> void
2+
Microsoft.AspNetCore.Builder.ExceptionHandlerOptions.CreateScopeForErrors.get -> bool
3+
Microsoft.AspNetCore.Builder.ExceptionHandlerOptions.CreateScopeForErrors.set -> void
44
Microsoft.AspNetCore.Diagnostics.IExceptionHandler
55
Microsoft.AspNetCore.Diagnostics.IExceptionHandler.TryHandleAsync(Microsoft.AspNetCore.Http.HttpContext! httpContext, System.Exception! exception, System.Threading.CancellationToken cancellationToken) -> System.Threading.Tasks.ValueTask<bool>
66
Microsoft.AspNetCore.Diagnostics.StatusCodeReExecuteFeature.OriginalStatusCode.get -> int

0 commit comments

Comments
 (0)