@@ -41,10 +41,7 @@ namespace log4net.Tests.Context;
4141public class LogicalThreadContextTest
4242{
4343 [ TearDown ]
44- public void TearDown ( )
45- {
46- Utils . RemovePropertyFromAllContexts ( ) ;
47- }
44+ public void TearDown ( ) => Utils . RemovePropertyFromAllContexts ( ) ;
4845
4946 [ Test ]
5047 public void TestLogicalThreadPropertiesPatternBasicGetSet ( )
@@ -100,7 +97,7 @@ public async Task TestLogicalThreadPropertiesPatternAsyncAwait()
10097 Assert . That ( stringAppender . GetString ( ) , Is . EqualTo ( testValueForCurrentContext ) , "Test logical thread properties value set" ) ;
10198 stringAppender . Reset ( ) ;
10299
103- var strings = await Task . WhenAll ( Enumerable . Range ( 0 , 10 ) . Select ( x => SomeWorkProperties ( x . ToString ( ) ) ) ) ;
100+ string [ ] strings = await Task . WhenAll ( Enumerable . Range ( 0 , 10 ) . Select ( x => SomeWorkProperties ( x . ToString ( ) ) ) ) . ConfigureAwait ( false ) ;
104101
105102 // strings should be ["00AA0BB0", "01AA1BB1", "02AA2BB2", ...]
106103 for ( int i = 0 ; i < strings . Length ; i ++ )
@@ -274,7 +271,7 @@ public async Task TestLogicalThreadStackPatternAsyncAwait()
274271 Assert . That ( stringAppender . GetString ( ) , Is . EqualTo ( testValueForCurrentContext ) , "Test logical thread stack value set" ) ;
275272 stringAppender . Reset ( ) ;
276273
277- strings = await Task . WhenAll ( Enumerable . Range ( 0 , 10 ) . Select ( x => SomeWorkStack ( x . ToString ( ) ) ) ) ;
274+ strings = await Task . WhenAll ( Enumerable . Range ( 0 , 10 ) . Select ( x => SomeWorkStack ( x . ToString ( ) ) ) ) . ConfigureAwait ( false ) ;
278275 }
279276
280277 // strings should be ["Outer 0 AOuter 0 AOuter 0Outer 0 BOuter 0 B Outer 0", ...]
@@ -305,9 +302,9 @@ static async Task<string> SomeWorkProperties(string propertyName)
305302 LogicalThreadContext . Properties [ Utils . PropertyKey ] = propertyName ;
306303 log . Info ( "TestMessage" ) ;
307304
308- await MoreWorkProperties ( log , "A" ) ;
305+ await MoreWorkProperties ( log , "A" ) . ConfigureAwait ( false ) ;
309306 log . Info ( "TestMessage" ) ;
310- await MoreWorkProperties ( log , "B" ) ;
307+ await MoreWorkProperties ( log , "B" ) . ConfigureAwait ( false ) ;
311308 log . Info ( "TestMessage" ) ;
312309 return stringAppender . GetString ( ) ;
313310 }
@@ -316,7 +313,7 @@ static async Task MoreWorkProperties(ILog log, string propertyName)
316313 {
317314 LogicalThreadContext . Properties [ Utils . PropertyKey ] = propertyName ;
318315 log . Info ( "TestMessage" ) ;
319- await Task . Delay ( 1 ) ;
316+ await Task . Delay ( 1 ) . ConfigureAwait ( false ) ;
320317 log . Info ( "TestMessage" ) ;
321318 }
322319
@@ -338,9 +335,9 @@ private static async Task<string> SomeWorkStack(string stackName)
338335 Assert . That ( stringAppender . GetString ( ) , Is . EqualTo ( string . Format ( "Outer {0}" , stackName ) ) , "Test logical thread stack value set" ) ;
339336 stringAppender . Reset ( ) ;
340337
341- await MoreWorkStack ( log , "A" ) ;
338+ await MoreWorkStack ( log , "A" ) . ConfigureAwait ( false ) ;
342339 log . Info ( "TestMessage" ) ;
343- await MoreWorkStack ( log , "B" ) ;
340+ await MoreWorkStack ( log , "B" ) . ConfigureAwait ( false ) ;
344341 log . Info ( "TestMessage" ) ;
345342 }
346343
@@ -352,7 +349,7 @@ static async Task MoreWorkStack(ILog log, string stackName)
352349 using ( LogicalThreadContext . Stacks [ Utils . PropertyKey ] . Push ( stackName ) )
353350 {
354351 log . Info ( "TestMessage" ) ;
355- await Task . Delay ( 1 ) ;
352+ await Task . Delay ( 1 ) . ConfigureAwait ( false ) ;
356353 log . Info ( "TestMessage" ) ;
357354 }
358355 }
0 commit comments