@@ -235,23 +235,16 @@ static TextWriter EnsureInitialized()
235
235
236
236
private static TextWriter CreateOutputWriter ( Stream outputStream )
237
237
{
238
- if ( outputStream == Stream . Null )
239
- return TextWriter . Null ;
240
-
241
- StreamWriter writer = new StreamWriter (
242
- stream : outputStream ,
243
- encoding : OutputEncoding . RemovePreamble ( ) , // This ensures no prefix is written to the stream.
244
- bufferSize : WriteBufferSize ,
245
- leaveOpen : true
246
- ) {
247
- AutoFlush = true
248
- } ;
249
-
250
- #if TARGET_BROWSER && ! FEATURE_WASM_MANAGED_THREADS
251
- return writer ;
252
- #else
253
- return TextWriter . Synchronized ( writer ) ;
254
- #endif
238
+ return outputStream == Stream . Null ?
239
+ TextWriter . Null :
240
+ TextWriter . Synchronized ( new StreamWriter (
241
+ stream : outputStream ,
242
+ encoding : OutputEncoding . RemovePreamble ( ) , // This ensures no prefix is written to the stream.
243
+ bufferSize : WriteBufferSize ,
244
+ leaveOpen : true )
245
+ {
246
+ AutoFlush = true
247
+ } ) ;
255
248
}
256
249
257
250
private static StrongBox < bool > ? _isStdInRedirected ;
@@ -709,10 +702,7 @@ public static void SetOut(TextWriter newOut)
709
702
// are nops.
710
703
if ( newOut != TextWriter . Null )
711
704
{
712
- #if TARGET_BROWSER && ! FEATURE_WASM_MANAGED_THREADS
713
- #else
714
705
newOut = TextWriter . Synchronized ( newOut ) ;
715
- #endif
716
706
}
717
707
718
708
lock ( s_syncObject )
@@ -729,10 +719,7 @@ public static void SetError(TextWriter newError)
729
719
// Ensure all access to the writer is synchronized. See comment in SetOut.
730
720
if ( newError != TextWriter . Null )
731
721
{
732
- #if TARGET_BROWSER && ! FEATURE_WASM_MANAGED_THREADS
733
- #else
734
722
newError = TextWriter . Synchronized ( newError ) ;
735
- #endif
736
723
}
737
724
738
725
lock ( s_syncObject )
0 commit comments