File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed
Parse/Platform/LiveQueries Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -117,10 +117,10 @@ public enum ParseLiveQueryState
117117 /// </remarks>
118118 public ParseLiveQueryController ( int timeOut , IWebSocketClient webSocketClient , IParseDataDecoder decoder )
119119 {
120+ WebSocketClient = webSocketClient ?? throw new ArgumentNullException ( nameof ( webSocketClient ) ) ;
121+ Decoder = decoder ?? throw new ArgumentNullException ( nameof ( decoder ) ) ;
120122 TimeOut = timeOut ;
121- WebSocketClient = webSocketClient ;
122123 _state = ParseLiveQueryState . Closed ;
123- Decoder = decoder ;
124124 }
125125
126126 private void ProcessMessage ( IDictionary < string , object > message )
@@ -413,9 +413,13 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default)
413413 ConnectionSignal = null ;
414414 }
415415 }
416- else if ( _state == ParseLiveQueryState . Connecting && ConnectionSignal is not null )
416+ else if ( _state == ParseLiveQueryState . Connecting )
417417 {
418- await ConnectionSignal . Task . WaitAsync ( cancellationToken ) ;
418+ TaskCompletionSource signal = ConnectionSignal ;
419+ if ( signal is not null )
420+ {
421+ await signal . Task . WaitAsync ( cancellationToken ) ;
422+ }
419423 }
420424 }
421425
@@ -607,7 +611,17 @@ private void Dispose(bool disposing)
607611 if ( disposing )
608612 {
609613 // For sync disposal, the best effort cleanup without waiting
610- _ = Task . Run ( async ( ) => await CloseAsync ( ) ) ;
614+ _ = Task . Run ( async ( ) =>
615+ {
616+ try
617+ {
618+ await CloseAsync ( ) ;
619+ }
620+ catch ( Exception ex )
621+ {
622+ Debug . WriteLine ( $ "Error during disposal: { ex } ") ;
623+ }
624+ } ) ;
611625 }
612626 disposed = true ;
613627 }
You can’t perform that action at this time.
0 commit comments