@@ -128,16 +128,17 @@ public virtual void Release(string sessionId)
128128 public async Task < SessionToken ? > CheckForUpdateAsync ( string ? currentVersion , CancellationToken cancellationToken = default )
129129 {
130130 string [ ] ? parameters = ! string . IsNullOrEmpty ( currentVersion )
131- ? new [ ] { ReplicationService . REPLICATE_VERSION_PARAM , currentVersion ! }
131+ ? new [ ] { ReplicationService . REPLICATE_VERSION_PARAM , currentVersion ! } // [!]: verified above
132132 : null ;
133133
134134 using var response = await ExecuteGetAsync (
135- ReplicationService . ReplicationAction . UPDATE . ToString ( ) ,
136- parameters ?? Array . Empty < string > ( ) ,
135+ nameof ( ReplicationService . ReplicationAction . UPDATE ) ,
136+ parameters ,
137137 cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
138138
139139 return await DoActionAsync ( response , async ( ) =>
140140 {
141+ // ReSharper disable once AccessToDisposedClosure - DoActionAsync definitively returns after this lambda is invoked
141142 using var inputStream = new DataInputStream (
142143 await GetResponseStreamAsync ( response , cancellationToken ) . ConfigureAwait ( false ) ) ;
143144
@@ -156,16 +157,16 @@ public virtual void Release(string sessionId)
156157 public async Task < Stream > ObtainFileAsync ( string sessionId , string source , string fileName , CancellationToken cancellationToken = default )
157158 {
158159 using var response = await ExecuteGetAsync (
159- ReplicationService . ReplicationAction . OBTAIN . ToString ( ) ,
160+ nameof ( ReplicationService . ReplicationAction . OBTAIN ) ,
160161 ReplicationService . REPLICATE_SESSION_ID_PARAM , sessionId ,
161162 ReplicationService . REPLICATE_SOURCE_PARAM , source ,
162163 ReplicationService . REPLICATE_FILENAME_PARAM , fileName ,
163164 cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
164165
165- return await DoActionAsync ( response , async ( ) =>
166- {
167- return await GetResponseStreamAsync ( response , cancellationToken ) . ConfigureAwait ( false ) ;
168- } ) . ConfigureAwait ( false ) ;
166+ return await DoActionAsync ( response ,
167+ // ReSharper disable once AccessToDisposedClosure - DoActionAsync definitively returns after this lambda is invoked
168+ async ( ) => await GetResponseStreamAsync ( response , cancellationToken ) . ConfigureAwait ( false ) )
169+ . ConfigureAwait ( false ) ;
169170 }
170171
171172 /// <summary>
@@ -191,7 +192,7 @@ public Task PublishAsync(IRevision revision, CancellationToken cancellationToken
191192 public async Task ReleaseAsync ( string sessionId , CancellationToken cancellationToken = default )
192193 {
193194 using var response = await ExecuteGetAsync (
194- ReplicationService . ReplicationAction . RELEASE . ToString ( ) ,
195+ nameof ( ReplicationService . ReplicationAction . RELEASE ) ,
195196 ReplicationService . REPLICATE_SESSION_ID_PARAM , sessionId ,
196197 cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
197198
@@ -206,4 +207,3 @@ await DoActionAsync(response, () =>
206207
207208 }
208209}
209- #nullable restore
0 commit comments