@@ -285,27 +285,6 @@ public void AddEnvironmentVariablesUsingPrefixWithDoubleUnderscores_Bind_PrefixM
285285
286286 [ ConditionalFact ( typeof ( PlatformDetection ) , nameof ( PlatformDetection . IsThreadingSupported ) ) ]
287287 public void BindingDoesNotThrowIfReloadedDuringBinding ( )
288- {
289- // Instrumentation for https://github.com/dotnet/runtime/issues/109904. Failfast to generate a crash dump when the test fails with NullReferenceException.
290- try
291- {
292- BindingDoesNotThrowIfReloadedDuringBindingWorker ( ) ;
293- }
294- catch ( NullReferenceException ) when ( FailFast ( ) )
295- {
296- }
297-
298- static bool FailFast ( )
299- {
300- Environment . FailFast (
301- "Instrumentation for https://github.com/dotnet/runtime/issues/109904" + Environment . NewLine +
302- "Microsoft.Extensions.Configuration.EnvironmentVariables.Test.EnvironmentVariablesTest.BindingDoesNotThrowIfReloadedDuringBinding [FAIL]" + Environment . NewLine +
303- "System.NullReferenceException : Object reference not set to an instance of an object." ) ;
304- return false ;
305- }
306- }
307-
308- private void BindingDoesNotThrowIfReloadedDuringBindingWorker ( )
309288 {
310289 var dic = new Dictionary < string , string >
311290 {
@@ -317,8 +296,6 @@ private void BindingDoesNotThrowIfReloadedDuringBindingWorker()
317296 configurationBuilder . AddEnvironmentVariables ( ) ;
318297 var config = configurationBuilder . Build ( ) ;
319298
320- MyOptions options = null ;
321-
322299 using ( var cts = new CancellationTokenSource ( TimeSpan . FromMilliseconds ( 250 ) ) )
323300 {
324301 void ReloadLoop ( )
@@ -331,14 +308,17 @@ void ReloadLoop()
331308
332309 _ = Task . Run ( ReloadLoop ) ;
333310
334- while ( ! cts . IsCancellationRequested )
311+ MyOptions options ;
312+
313+ do
335314 {
336315 options = config . Get < MyOptions > ( ) ;
337316 }
338- }
317+ while ( ! cts . IsCancellationRequested ) ;
339318
340- Assert . Equal ( - 2 , options . Number ) ;
341- Assert . Equal ( "Foo" , options . Text ) ;
319+ Assert . Equal ( - 2 , options . Number ) ;
320+ Assert . Equal ( "Foo" , options . Text ) ;
321+ }
342322 }
343323
344324 private sealed class MyOptions
0 commit comments