Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Commit afa3958

Browse files
committed
Add ConfigureAwait to awaitable method calls
1 parent 1555ec5 commit afa3958

File tree

6 files changed

+8
-8
lines changed

6 files changed

+8
-8
lines changed

Toastify/src/Core/Auth/AuthHttpServer.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public AuthHttpServer()
4242

4343
public async Task Start()
4444
{
45-
await this.webHost.StartAsync();
45+
await this.webHost.StartAsync().ConfigureAwait(false);
4646
this.receiveThread = new Thread(this.ReceiveThread)
4747
{
4848
Name = $"Toastify_{nameof(AuthHttpServer)}_ReceiveThread_{RuntimeHelpers.GetHashCode(this)}"

Toastify/src/Core/Auth/AuthHttpServerStartup.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
6767
{
6868
using (var pipe = new NamedPipeClientStream(".", this.Configuration["pipeName"], PipeDirection.Out, PipeOptions.None, TokenImpersonationLevel.Anonymous))
6969
{
70-
await pipe.ConnectAsync();
70+
await pipe.ConnectAsync().ConfigureAwait(false);
7171
StringStream ss = new StringStream(pipe);
7272

7373
var content = HttpUtility.ParseQueryString(string.Empty);
@@ -92,7 +92,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
9292
context.Response.StatusCode = (int)HttpStatusCode.BadRequest;
9393
}
9494
else
95-
await next();
95+
await next().ConfigureAwait(false);
9696
});
9797
}
9898
}

Toastify/src/Core/Broadcaster/ToastifyWebSocketHostStartup.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ protected override void OnWebSocketClosed(HttpContext context, WebSocket webSock
232232
private static async Task RedirectTo(string message, WebSocket socket)
233233
{
234234
if (socket != null && socket.State == WebSocketState.Open && !string.IsNullOrWhiteSpace(message))
235-
await socket.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(message)), WebSocketMessageType.Text, true, CancellationToken.None);
235+
await socket.SendAsync(new ArraySegment<byte>(Encoding.UTF8.GetBytes(message)), WebSocketMessageType.Text, true, CancellationToken.None).ConfigureAwait(false);
236236
}
237237

238238
#endregion

Toastify/src/Core/Spotify.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ private void BeginInitializeWebAPI()
293293
else if (!string.IsNullOrWhiteSpace(savedToken.RefreshToken))
294294
{
295295
logger.Debug("Cached token is expired. Refreshing it...");
296-
savedToken = await this.Web.Auth.RefreshToken(savedToken);
296+
savedToken = await this.Web.Auth.RefreshToken(savedToken).ConfigureAwait(false);
297297
if (savedToken != null)
298298
{
299299
token = savedToken;
@@ -325,7 +325,7 @@ private void BeginInitializeWebAPI()
325325
{
326326
// Request new token
327327
logger.Debug("Requesting new token...");
328-
token = await this.Web.Auth.GetToken();
328+
token = await this.Web.Auth.GetToken().ConfigureAwait(false);
329329
if (token != null)
330330
Security.SaveProtectedObject(token, tokenFileName);
331331
}

Toastify/src/View/SettingsView.xaml.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -589,7 +589,7 @@ private async void ComboBox_OnInitialized(object sender, EventArgs e)
589589
{
590590
await Task.Delay(TimeSpan.FromSeconds(0.5)).ConfigureAwait(false);
591591
if (sender is ComboBox cb)
592-
await Task.Run(() => this.InitializeExpandableElementForUIAutomation(cb));
592+
await Task.Run(() => this.InitializeExpandableElementForUIAutomation(cb)).ConfigureAwait(false);
593593
}
594594

595595
private void InitializeExpandableElementForUIAutomation(IFrameworkInputElement element)

0 commit comments

Comments
 (0)