@@ -50,11 +50,7 @@ public HttpContentClientStreamReader(GrpcCall<TRequest, TResponse> call)
5050 HttpResponseTcs = new TaskCompletionSource < ( HttpResponseMessage , Status ? ) > ( TaskCreationOptions . RunContinuationsAsynchronously ) ;
5151 }
5252
53- // IAsyncStreamReader<T> should declare Current as nullable
54- // Suppress warning when overriding interface definition
55- #pragma warning disable CS8613 , CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member.
56- public TResponse ? Current { get ; private set ; }
57- #pragma warning restore CS8613 , CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member.
53+ public TResponse Current { get ; private set ; } = default ! ;
5854
5955 public void Dispose ( )
6056 {
@@ -156,12 +152,13 @@ private async Task<bool> MoveNextCore(CancellationToken cancellationToken)
156152
157153 CompatibilityHelpers . Assert ( _grpcEncoding != null , "Encoding should have been calculated from response." ) ;
158154
159- Current = await _call . ReadMessageAsync (
155+ var readMessage = await _call . ReadMessageAsync (
160156 _responseStream ,
161157 _grpcEncoding ,
162158 singleMessage : false ,
163159 _call . CancellationToken ) . ConfigureAwait ( false ) ;
164- if ( Current == null )
160+
161+ if ( readMessage == null )
165162 {
166163 // No more content in response so report status to call.
167164 // The call will handle finishing the response.
@@ -172,10 +169,12 @@ private async Task<bool> MoveNextCore(CancellationToken cancellationToken)
172169 throw _call . CreateFailureStatusException ( status ) ;
173170 }
174171
172+ Current = null ! ;
175173 return false ;
176174 }
177175
178176 GrpcEventSource . Log . MessageReceived ( ) ;
177+ Current = readMessage ! ;
179178 return true ;
180179 }
181180 catch ( OperationCanceledException ex )
0 commit comments