55using System . Diagnostics ;
66using System . IO . Pipes ;
77using System . Runtime . InteropServices ;
8+ using System . Runtime . Versioning ;
89using System . Security . Principal ;
910using Windows . Win32 . Foundation ;
10- #if WINDOWS
1111using static Windows . Win32 . PInvoke ;
12- #endif
1312
1413namespace Microsoft . ServiceHub . Framework ;
1514
@@ -103,7 +102,6 @@ public static async Task<Stream> ConnectAsync(string pipeName, ClientOptions opt
103102 PipeStream ? pipeStream = null ;
104103 try
105104 {
106- #if WINDOWS
107105 if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
108106 {
109107 pipeStream = new AsyncNamedPipeClientStream ( "." , name , PipeDirection . InOut , pipeOptions ) ;
@@ -114,10 +112,6 @@ public static async Task<Stream> ConnectAsync(string pipeName, ClientOptions opt
114112 pipeStream = new NamedPipeClientStream ( "." , name , PipeDirection . InOut , pipeOptions ) ;
115113 await ConnectWithRetryAsync ( ( NamedPipeClientStream ) pipeStream , fullPipeOptions , cancellationToken , maxRetries , withSpinningWait : options . CpuSpinOverFirstChanceExceptions ) . ConfigureAwait ( false ) ;
116114 }
117- #else
118- pipeStream = new NamedPipeClientStream ( "." , name , PipeDirection . InOut , pipeOptions ) ;
119- await ConnectWithRetryAsync ( ( NamedPipeClientStream ) pipeStream , fullPipeOptions , cancellationToken , maxRetries , withSpinningWait : options . CpuSpinOverFirstChanceExceptions ) . ConfigureAwait ( false ) ;
120- #endif
121115
122116 return pipeStream ;
123117 }
0 commit comments