-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Await using #436
Await using #436
Conversation
# Conflicts: # source/Halibut.Tests/Transport/ConnectionManagerFixture.cs
# Conflicts: # source/Halibut.Tests/Transport/ConnectionPoolFixture.cs # source/Halibut/Transport/ConnectionManager.cs # source/Halibut/Transport/ConnectionPool.cs
# Conflicts: # source/Halibut.Tests/Support/TestConnection.cs # source/Halibut.Tests/Transport/ConnectionPoolFixture.cs # source/Halibut/HalibutRuntime.cs # source/Halibut/Transport/ConnectionManager.cs # source/Halibut/Transport/ConnectionManagerAsync.cs # source/Halibut/Transport/ConnectionPool.cs # source/Halibut/Transport/ConnectionPoolAsync.cs # source/Halibut/Transport/IConnectionManager.cs # source/Halibut/Transport/IConnectionPool.cs # source/Halibut/Transport/SecureClient.cs # source/Halibut/Transport/SecureListeningClient.cs # source/Halibut/Transport/SecureWebSocketClient.cs
# Conflicts: # source/Halibut/ServiceModel/PendingRequestQueueAsync.cs # source/Halibut/Transport/SecureConnection.cs
# Conflicts: # source/Halibut/Transport/ConnectionManager.cs # source/Halibut/Transport/ConnectionPool.cs
This pull request has been linked to Shortcut Story #53211: 🎉 🎉 🎉 Make Halibut Support Async RPC Calls 🎉 🎉 🎉. |
[sc-57124] |
# Conflicts: # source/Halibut.Tests/Timeouts/SendingAndReceivingRequestMessagesTimeoutsFixture.cs # source/Halibut/Transport/DiscoveryClient.cs # source/Halibut/Transport/Protocol/MessageSerializer.cs # source/Halibut/Transport/SecureListener.cs # source/Halibut/Transport/SecureWebSocketListener.cs
This pull request has been linked to Shortcut Story #53211: 🎉 🎉 🎉 Make Halibut Support Async RPC Calls 🎉 🎉 🎉. |
var e = (await AssertAsync.Throws<HalibutClientException>(() => echoServiceTheErrorWillHappenOn.SayHelloAsync(stringToSend))).And; | ||
var e = (await AssertAsync.Throws<HalibutClientException>(() => | ||
{ | ||
var stringToSend = Some.RandomAsciiStringOfLength(numberOfBytesBeforePausingAStream * 20); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was driving me nuts debugging in this area, and having VS take ages to "evaluate local variables" because of this large string.
So I made sure it was no longer in scope. Solved!
@@ -23,7 +23,13 @@ public TcpTunnel(TcpClient fromClient, TcpClient toClient, ILogger logger) | |||
|
|||
public async Task Tunnel(CancellationToken cancellationToken) | |||
{ | |||
#if !NETFRAMEWORK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If only dotnet had #define
or better yet virtual threads.
[sc-57123] |
This pull request has been linked to Shortcut Story #57123: RewindableBufferStream needs an async Dispose method (and that to be tested). |
[sc-53211]
Background
Continuing on from making disposing async, we need to make disposal with
using
statements become async.Results
Related to OctopusDeploy/Issues#8266
Before
Whenever something that supports async operations is disposed, it does the disposal synchronously on the thread. This blocks the thread if disposal involves things like IO.
After
We now try to use
await using
instead ofusing
do that any asynchronous operations done during disposal will no longer block the calling thread..NET 4.8 Complications
Streams in .NET 4.8 do not support
IAsyncDisposable
. This means we cannot addawait
tousing
statements.This was fixed by wrapping the
await
in a#if
RewindableBufferStream
We also made
RewindableBufferStream
implementIAsyncDisposable
. This allowed us to usingawait using
whenever we interacted with this type of stream.Using Our Streams
We made all our streams extend
IAsyncDisposable
so that they would work in .NET 4.8 withawait using
How to review this PR
Quality ✔️
Pre-requisites