Skip to content

Commit

Permalink
Fix scope being disposed prematurely
Browse files Browse the repository at this point in the history
Somehow this didn't happen in .NET 7,
but obviously the code is wrong here.
A classic case of using and then not
awaiting the task, leading to a race
condition.

I suppose this is a follow-up on
6cebeb1
  • Loading branch information
Sebazzz committed Nov 15, 2023
1 parent af1360e commit 0723e45
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ******************************************************************************
// © 2019 Sebastiaan Dammann | damsteen.nl
//
//
// File: : JoinRetrospectiveTests.cs
// Project : Return.Web.Tests.Integration
// ******************************************************************************
Expand Down Expand Up @@ -181,9 +181,9 @@ public async Task JoinRetrospectivePage_KnownRetrospective_JoinAsFacilitatorUpda
Assert.That(() => secondInstance.OnlineList.OnlineListItems.AllInnerTextsAsync().GetAwaiter().GetResult(), Has.One.Contains(myName));
}

private Task SetRetrospective(string retroId, Action<Retrospective> action) {
private async Task SetRetrospective(string retroId, Action<Retrospective> action) {
using IServiceScope scope = this.App.CreateTestServiceScope();
return scope.SetRetrospective(retroId, action);
await scope.SetRetrospective(retroId, action);
}

private async Task<string> CreateRetrospective(string facilitatorPassword, string password) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ******************************************************************************
// © Sebastiaan Dammann | damsteen.nl
//
//
// File: : RetrospectiveLobbyTestsBase.cs
// Project : Return.Web.Tests.Integration
// ******************************************************************************
Expand Down Expand Up @@ -67,9 +67,9 @@ protected async Task Join(RetrospectiveLobby pageObject, bool facilitator, strin

protected Task WaitNavigatedToLobby() => Task.WhenAll(WaitNavigatedToLobby(this.Client1), WaitNavigatedToLobby(this.Client2));

protected Task SetRetrospective(Action<Retrospective> action) {
protected async Task SetRetrospective(Action<Retrospective> action) {
using IServiceScope scope = this.App.CreateTestServiceScope();
return scope.SetRetrospective(this.RetroId, action);
await scope.SetRetrospective(this.RetroId, action);
}

private static async Task WaitNavigatedToLobby(RetrospectiveLobby pageObject) {
Expand Down

0 comments on commit 0723e45

Please sign in to comment.