Skip to content

Commit

Permalink
Using using.
Browse files Browse the repository at this point in the history
  • Loading branch information
Psichorex committed Feb 1, 2024
1 parent 1c033d5 commit 8b9592e
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions Lombiq.Tests.UI/Extensions/TypedRouteUITestContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ public static string GetRelativeUrlOfAction<TController>(
params (string Key, object Value)[] additionalArguments)
where TController : ControllerBase
{
// We can't dispose the scope here because it would lead to exceptions in the consumers.
#pragma warning disable CA2000 // Dispose objects before losing scope
var serviceProvider = CreateServiceProvider(context);
#pragma warning restore CA2000 // Dispose objects before losing scope
using var serviceProvider = CreateServiceProvider(context);
var route = TypedRoute
.CreateFromExpression(actionExpression, additionalArguments, serviceProvider)
.ToString();
Expand All @@ -67,10 +64,7 @@ public static string GetRelativeUrlOfAction<TController>(
params (string Key, object Value)[] additionalArguments)
where TController : ControllerBase
{
// We can't dispose the scope here because it would lead to exceptions in the consumers.
#pragma warning disable CA2000 // Dispose objects before losing scope
var serviceProvider = CreateServiceProvider(context);
#pragma warning restore CA2000 // Dispose objects before losing scope
using var serviceProvider = CreateServiceProvider(context);

var route = TypedRoute
.CreateFromExpression(actionExpressionAsync.StripResult(), additionalArguments, serviceProvider)
Expand Down

0 comments on commit 8b9592e

Please sign in to comment.