@@ -21,9 +21,9 @@ public partial class ConnectionMultiplexer
2121 /// <param name="members">The initial configurations to connect to.</param>
2222 /// <param name="options">Additional options for configuring this group.</param>
2323 /// <param name="log">The <see cref="TextWriter"/> to log to.</param>
24- #pragma warning disable RS0016 , RS0026
24+ #pragma warning disable RS0026
2525 public static Task < IConnectionGroup > ConnectGroupAsync ( ConnectionGroupMember [ ] members , MultiGroupOptions ? options = null , TextWriter ? log = null )
26- #pragma warning restore RS0016 , RS0026
26+ #pragma warning restore RS0026
2727 {
2828 // create a defensive copy of the array; we don't want callers being able to radically swap things!
2929 members = ( ConnectionGroupMember [ ] ) members . Clone ( ) ;
@@ -40,13 +40,13 @@ public static Task<IConnectionGroup> ConnectGroupAsync(ConnectionGroupMember[] m
4040 /// <param name="member1">An additional initial configuration to connect to.</param>
4141 /// <param name="options">Additional options for configuring this group.</param>
4242 /// <param name="log">The <see cref="TextWriter"/> to log to.</param>
43- #pragma warning disable RS0016 , RS0026
43+ #pragma warning disable RS0026
4444 public static Task < IConnectionGroup > ConnectGroupAsync (
4545 ConnectionGroupMember member0 ,
4646 ConnectionGroupMember member1 ,
4747 MultiGroupOptions ? options = null ,
4848 TextWriter ? log = null )
49- #pragma warning restore RS0016 , RS0026
49+ #pragma warning restore RS0026
5050 {
5151 options ??= MultiGroupOptions . Default ;
5252 options . Freeze ( ) ;
@@ -326,6 +326,7 @@ static bool TrySelectPreferredGroup(WeakReference weakRef)
326326 {
327327 try
328328 {
329+ if ( typed . IsDisposed ) return false ;
329330 typed . SelectPreferredGroup ( ) ;
330331 }
331332 catch ( Exception ex )
@@ -338,8 +339,11 @@ static bool TrySelectPreferredGroup(WeakReference weakRef)
338339 }
339340 }
340341
342+ internal bool IsDisposed => _disposed ;
343+
341344 internal void SelectPreferredGroup ( )
342345 {
346+ if ( _disposed ) return ;
343347 var previousMuxer = _active ;
344348 ConnectionGroupMember ? preferredMember = null , previousMember = null ;
345349 var members = _members ;
0 commit comments