diff --git a/CHANGELOG.md b/CHANGELOG.md
index cfee9751..af4fc7ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -92,6 +92,7 @@ Please ADD ALL Changes to the UNRELEASED SECTION and not a specific release
- Dependencies - Updated Microsoft.NET.Test.Sdk to 18.11.0
- Dependencies - Updated Meziantou.Analyzer to 3.0.317
- BuildBot is published trimmed and as a native AOT binary with InvariantGlobalization enabled, and the Docker image uses the plain chiseled runtime-deps base; unused System.Reactive and System.Interactive.Async packages and Serilog.Enrichers.Demystifier are removed, and buildcheck configuration binding generator properties are fixed (#430)
+- Dependencies - Updated Microsoft.VisualStudio.Threading.Analyzers to 18.12.1
### Deprecated
### Removed
- Removed NuGet audit suppressions for Scriban 6.2.0 vulnerabilities now that the transitive dependency has been dropped
diff --git a/src/BuildBot.CloudFormation.Tests/BuildBot.CloudFormation.Tests.csproj b/src/BuildBot.CloudFormation.Tests/BuildBot.CloudFormation.Tests.csproj
index d7b6bfde..daf67ecb 100644
--- a/src/BuildBot.CloudFormation.Tests/BuildBot.CloudFormation.Tests.csproj
+++ b/src/BuildBot.CloudFormation.Tests/BuildBot.CloudFormation.Tests.csproj
@@ -55,7 +55,7 @@
-
+
diff --git a/src/BuildBot.CloudFormation/BuildBot.CloudFormation.csproj b/src/BuildBot.CloudFormation/BuildBot.CloudFormation.csproj
index d450daed..a400e156 100644
--- a/src/BuildBot.CloudFormation/BuildBot.CloudFormation.csproj
+++ b/src/BuildBot.CloudFormation/BuildBot.CloudFormation.csproj
@@ -51,7 +51,7 @@
-
+
diff --git a/src/BuildBot.Discord.Tests/BuildBot.Discord.Tests.csproj b/src/BuildBot.Discord.Tests/BuildBot.Discord.Tests.csproj
index 8e80a231..22c31ea6 100644
--- a/src/BuildBot.Discord.Tests/BuildBot.Discord.Tests.csproj
+++ b/src/BuildBot.Discord.Tests/BuildBot.Discord.Tests.csproj
@@ -56,7 +56,7 @@
-
+
diff --git a/src/BuildBot.Discord.Tests/Services/DiscordWebhookClientTests.cs b/src/BuildBot.Discord.Tests/Services/DiscordWebhookClientTests.cs
index 58a17960..cf53de07 100644
--- a/src/BuildBot.Discord.Tests/Services/DiscordWebhookClientTests.cs
+++ b/src/BuildBot.Discord.Tests/Services/DiscordWebhookClientTests.cs
@@ -224,7 +224,7 @@ public async Task SendAsync_WhenRejectedBodyReadTimesOut_StillReturnsStatus()
payload: Payload,
cancellationToken: this.CancellationToken()
);
- await stream.ReadStarted.WaitAsync(this.CancellationToken());
+ await stream.WaitForReadStartedAsync(this.CancellationToken());
timeProvider.Advance(DiscordWebhookClient.ResponseBodyReadTimeout);
WebhookSendResult result = await sending;
@@ -253,7 +253,7 @@ public async Task SendAsync_WhenCancelledWhileReadingRejectedBody_Throws()
payload: Payload,
cancellationToken: cts.Token
);
- await stream.ReadStarted.WaitAsync(this.CancellationToken());
+ await stream.WaitForReadStartedAsync(this.CancellationToken());
await cts.CancelAsync();
await Assert.ThrowsAnyAsync(async () => await sending);
diff --git a/src/BuildBot.Discord.Tests/Services/StalledReadStream.cs b/src/BuildBot.Discord.Tests/Services/StalledReadStream.cs
index ff640658..9cf46972 100644
--- a/src/BuildBot.Discord.Tests/Services/StalledReadStream.cs
+++ b/src/BuildBot.Discord.Tests/Services/StalledReadStream.cs
@@ -7,9 +7,12 @@ namespace BuildBot.Discord.Tests.Services;
internal sealed class StalledReadStream : Stream
{
- private readonly TaskCompletionSource _readStarted = new(TaskCreationOptions.RunContinuationsAsynchronously);
+ private readonly SemaphoreSlim _readStarted = new(initialCount: 0);
- public Task ReadStarted => this._readStarted.Task;
+ public Task WaitForReadStartedAsync(CancellationToken cancellationToken)
+ {
+ return this._readStarted.WaitAsync(cancellationToken);
+ }
public override bool CanRead => true;
@@ -25,6 +28,16 @@ public override long Position
set => throw new NotSupportedException();
}
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing)
+ {
+ this._readStarted.Dispose();
+ }
+
+ base.Dispose(disposing);
+ }
+
public override void Flush() { }
public override int Read(byte[] buffer, int offset, int count)
@@ -34,7 +47,7 @@ public override int Read(byte[] buffer, int offset, int count)
public override async ValueTask ReadAsync(Memory buffer, CancellationToken cancellationToken = default)
{
- this._readStarted.TrySetResult();
+ this._readStarted.Release();
// Only cancellation ends the read, as with a server that sent headers and then stopped sending.
await Task.Delay(millisecondsDelay: Timeout.Infinite, cancellationToken: cancellationToken);
diff --git a/src/BuildBot.Discord/BuildBot.Discord.csproj b/src/BuildBot.Discord/BuildBot.Discord.csproj
index fea4e47e..dc92b72e 100644
--- a/src/BuildBot.Discord/BuildBot.Discord.csproj
+++ b/src/BuildBot.Discord/BuildBot.Discord.csproj
@@ -51,7 +51,7 @@
-
+
diff --git a/src/BuildBot.GitHub.Tests/BuildBot.GitHub.Tests.csproj b/src/BuildBot.GitHub.Tests/BuildBot.GitHub.Tests.csproj
index 420d6a06..2150d165 100644
--- a/src/BuildBot.GitHub.Tests/BuildBot.GitHub.Tests.csproj
+++ b/src/BuildBot.GitHub.Tests/BuildBot.GitHub.Tests.csproj
@@ -56,7 +56,7 @@
-
+
diff --git a/src/BuildBot.GitHub/BuildBot.GitHub.csproj b/src/BuildBot.GitHub/BuildBot.GitHub.csproj
index fa33afba..63812cb1 100644
--- a/src/BuildBot.GitHub/BuildBot.GitHub.csproj
+++ b/src/BuildBot.GitHub/BuildBot.GitHub.csproj
@@ -53,7 +53,7 @@
-
+
diff --git a/src/BuildBot.Health.Tests/BuildBot.Health.Tests.csproj b/src/BuildBot.Health.Tests/BuildBot.Health.Tests.csproj
index 0c6f5579..2178aefb 100644
--- a/src/BuildBot.Health.Tests/BuildBot.Health.Tests.csproj
+++ b/src/BuildBot.Health.Tests/BuildBot.Health.Tests.csproj
@@ -55,7 +55,7 @@
-
+
diff --git a/src/BuildBot.Health/BuildBot.Health.csproj b/src/BuildBot.Health/BuildBot.Health.csproj
index bbf4d4ee..b908959e 100644
--- a/src/BuildBot.Health/BuildBot.Health.csproj
+++ b/src/BuildBot.Health/BuildBot.Health.csproj
@@ -50,7 +50,7 @@
-
+
diff --git a/src/BuildBot.Json.Tests/BuildBot.Json.Tests.csproj b/src/BuildBot.Json.Tests/BuildBot.Json.Tests.csproj
index 880ab8fe..d25ef955 100644
--- a/src/BuildBot.Json.Tests/BuildBot.Json.Tests.csproj
+++ b/src/BuildBot.Json.Tests/BuildBot.Json.Tests.csproj
@@ -55,7 +55,7 @@
-
+
diff --git a/src/BuildBot.Json/BuildBot.Json.csproj b/src/BuildBot.Json/BuildBot.Json.csproj
index 4db32db3..59c3578e 100644
--- a/src/BuildBot.Json/BuildBot.Json.csproj
+++ b/src/BuildBot.Json/BuildBot.Json.csproj
@@ -47,7 +47,7 @@
-
+
diff --git a/src/BuildBot.ServiceModel.Tests/BuildBot.ServiceModel.Tests.csproj b/src/BuildBot.ServiceModel.Tests/BuildBot.ServiceModel.Tests.csproj
index 4c8d1208..b3826827 100644
--- a/src/BuildBot.ServiceModel.Tests/BuildBot.ServiceModel.Tests.csproj
+++ b/src/BuildBot.ServiceModel.Tests/BuildBot.ServiceModel.Tests.csproj
@@ -55,7 +55,7 @@
-
+
diff --git a/src/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj b/src/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj
index 4e5b54bf..c126dd70 100644
--- a/src/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj
+++ b/src/BuildBot.ServiceModel/BuildBot.ServiceModel.csproj
@@ -44,7 +44,7 @@
-
+
diff --git a/src/BuildBot.Tests/BuildBot.Tests.csproj b/src/BuildBot.Tests/BuildBot.Tests.csproj
index 413a322c..ad16468e 100644
--- a/src/BuildBot.Tests/BuildBot.Tests.csproj
+++ b/src/BuildBot.Tests/BuildBot.Tests.csproj
@@ -56,7 +56,7 @@
-
+
diff --git a/src/BuildBot.Watchtower.Tests/BuildBot.Watchtower.Tests.csproj b/src/BuildBot.Watchtower.Tests/BuildBot.Watchtower.Tests.csproj
index 8d1cc79e..aecbb57f 100644
--- a/src/BuildBot.Watchtower.Tests/BuildBot.Watchtower.Tests.csproj
+++ b/src/BuildBot.Watchtower.Tests/BuildBot.Watchtower.Tests.csproj
@@ -55,7 +55,7 @@
-
+
diff --git a/src/BuildBot.Watchtower/BuildBot.Watchtower.csproj b/src/BuildBot.Watchtower/BuildBot.Watchtower.csproj
index 7a54d769..8bd2f7fe 100644
--- a/src/BuildBot.Watchtower/BuildBot.Watchtower.csproj
+++ b/src/BuildBot.Watchtower/BuildBot.Watchtower.csproj
@@ -47,7 +47,7 @@
-
+
diff --git a/src/BuildBot/BuildBot.csproj b/src/BuildBot/BuildBot.csproj
index 9c341e95..f96dda3e 100644
--- a/src/BuildBot/BuildBot.csproj
+++ b/src/BuildBot/BuildBot.csproj
@@ -102,7 +102,7 @@
-
+