@@ -39,12 +39,12 @@ public static class GitHubUpdateManager {
39
39
using var httpClient = new HttpClient ( handler ) ;
40
40
using var request = new HttpRequestMessage ( HttpMethod . Get , string . Format ( Constants . APP_UPDATE_API , owner , repo ) ) ;
41
41
request . Headers . TryAddWithoutValidation ( "user-agent" , Constants . FAKE_USER_AGENT ) ;
42
- HttpResponseMessage response = await httpClient . SendAsync ( request ) ;
42
+ HttpResponseMessage response = await httpClient . SendAsync ( request ) . ConfigureAwait ( false ) ;
43
43
if ( ! response . IsSuccessStatusCode ) {
44
44
return null ;
45
45
}
46
46
47
- string body = await response . Content . ReadAsStringAsync ( ) ;
47
+ string body = await response . Content . ReadAsStringAsync ( ) . ConfigureAwait ( false ) ;
48
48
return JsonConvert . DeserializeObject < GithubLatestReleaseJson > ( body ) ;
49
49
}
50
50
@@ -55,7 +55,7 @@ public static async Task PrepareUpdate() {
55
55
try {
56
56
// To prepare the update, we just need to back up our files
57
57
string backupFolder = Path . Combine ( AppContext . BaseDirectory , ".." , "backup" ) ;
58
- await DeleteFolderRetry ( backupFolder ) ;
58
+ await DeleteFolderRetry ( backupFolder ) . ConfigureAwait ( false ) ;
59
59
60
60
Directory . CreateDirectory ( backupFolder ) ;
61
61
FileSystem . CopyDirectory ( AppContext . BaseDirectory , backupFolder ) ;
@@ -94,16 +94,16 @@ public static void ExitApplicationToUpdate() {
94
94
public static async Task PerformUpdateAndRestart ( string owner , string repo , string installFolder , string assetName ) {
95
95
try {
96
96
// Delete the old install folder.
97
- await DeleteFolderContentsRetry ( installFolder ) ;
97
+ await DeleteFolderContentsRetry ( installFolder ) . ConfigureAwait ( false ) ;
98
98
99
99
// Get the latest version of the application from GitHub.
100
100
string zipLocation = Path . Combine ( AppContext . BaseDirectory , assetName ) ;
101
- GithubLatestReleaseJson ? latestVersion = await GetLatestVersion ( owner , repo ) ;
101
+ GithubLatestReleaseJson ? latestVersion = await GetLatestVersion ( owner , repo ) . ConfigureAwait ( false ) ;
102
102
using ( var client = new HttpClient ( ) ) {
103
- using HttpResponseMessage response = await client . GetAsync ( $ "https://github.com/{ owner } /{ repo } /releases/download/{ latestVersion ? . name } /{ assetName } ") ;
104
- await using Stream streamToReadFrom = await response . Content . ReadAsStreamAsync ( ) ;
103
+ using HttpResponseMessage response = await client . GetAsync ( $ "https://github.com/{ owner } /{ repo } /releases/download/{ latestVersion ? . name } /{ assetName } ") . ConfigureAwait ( false ) ;
104
+ await using Stream streamToReadFrom = await response . Content . ReadAsStreamAsync ( ) . ConfigureAwait ( false ) ;
105
105
await using var fileStream = new FileStream ( zipLocation , FileMode . Create ) ;
106
- await streamToReadFrom . CopyToAsync ( fileStream ) ;
106
+ await streamToReadFrom . CopyToAsync ( fileStream ) . ConfigureAwait ( false ) ;
107
107
}
108
108
109
109
// Extract the zip file to the installation folder.
@@ -126,7 +126,7 @@ public static async Task PerformUpdateAndRestart(string owner, string repo, stri
126
126
public static async Task CleanupUpdate ( ) {
127
127
string backupFolder = Path . Combine ( AppContext . BaseDirectory , ".." , "backup" ) ;
128
128
129
- await DeleteFolderRetry ( backupFolder ) ;
129
+ await DeleteFolderRetry ( backupFolder ) . ConfigureAwait ( false ) ;
130
130
}
131
131
132
132
/// <summary>
@@ -141,7 +141,7 @@ await Retry.Execute(() => {
141
141
}
142
142
143
143
return Task . FromResult ( true ) ;
144
- } , 30 , waitTime : TimeSpan . FromSeconds ( 1 ) ) ;
144
+ } , 30 , waitTime : TimeSpan . FromSeconds ( 1 ) ) . ConfigureAwait ( false ) ;
145
145
}
146
146
catch ( Exception ex ) {
147
147
Log . Error ( ex ) ;
@@ -168,7 +168,7 @@ await Retry.Execute(() => {
168
168
}
169
169
170
170
return Task . FromResult ( true ) ;
171
- } , 30 , waitTime : TimeSpan . FromSeconds ( 1 ) ) ;
171
+ } , 30 , waitTime : TimeSpan . FromSeconds ( 1 ) ) . ConfigureAwait ( false ) ;
172
172
}
173
173
catch ( Exception ex ) {
174
174
Log . Error ( ex ) ;
0 commit comments