File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 1
1
using Microsoft . Extensions . Logging ;
2
- using Microsoft . Extensions . Options ;
3
2
using System ;
3
+ using Microsoft . Extensions . Options ;
4
4
using System . Collections . Generic ;
5
5
using System . Diagnostics ;
6
6
using System . IO ;
@@ -60,8 +60,9 @@ internal ChatClient(ConfigurationSettings settings, ILogger logger)
60
60
~ ChatClient ( )
61
61
{
62
62
63
- Logger . LogError ( "GC the ChatClient" ) ;
64
-
63
+ try {
64
+ Logger ? . LogError ( "GC the ChatClient" ) ;
65
+ } catch { }
65
66
// Do not change this code. Put cleanup code in Dispose(bool disposing) above.
66
67
Dispose ( false ) ;
67
68
}
@@ -294,7 +295,9 @@ private string ReadMessage()
294
295
protected virtual void Dispose ( bool disposing )
295
296
{
296
297
297
- Logger . LogWarning ( "Disposing of ChatClient" ) ;
298
+ try {
299
+ Logger ? . LogWarning ( "Disposing of ChatClient" ) ;
300
+ } catch { }
298
301
299
302
if ( ! disposedValue )
300
303
{
@@ -303,7 +306,7 @@ protected virtual void Dispose(bool disposing)
303
306
_Shutdown . Cancel ( ) ;
304
307
}
305
308
306
- _TcpClient . Dispose ( ) ;
309
+ _TcpClient ? . Dispose ( ) ;
307
310
disposedValue = true ;
308
311
}
309
312
}
You can’t perform that action at this time.
0 commit comments