dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
15.38k stars 4.75k forks source link

System.Threading.Threads.Tests.ThreadTests.InterruptInFinallyBlockTest_SkipOnDesktopFramework failure on Mono #36280

Open janvorli opened 4 years ago

janvorli commented 4 years ago

In a CI for the PR #36266, the System.Threading.Threads.Tests.ThreadTests.InterruptInFinallyBlockTest_SkipOnDesktopFramework has failed with:

System.AggregateException : One or more errors occurred. (Assert.Throws() Failure
Expected: typeof(System.Threading.ThreadInterruptedException)
Actual: typeof(Xunit.Sdk.TrueException): Assert.True() Failure
Expected: True
Actual: False)
---- Assert.Throws() Failure
Expected: typeof(System.Threading.ThreadInterruptedException)
Actual: typeof(Xunit.Sdk.TrueException): Assert.True() Failure
Expected: True
Actual: False
-------- Assert.True() Failure
Expected: True
Actual: False

   at System.Threading.Tests.ThreadTestHelpers.<>c__DisplayClass4_0.<CreateGuardedThread>b__1() in /_/src/libraries/Common/tests/System/Threading/ThreadTestHelpers.cs:line 52
   at System.Threading.Tests.ThreadTestHelpers.<>c__DisplayClass4_0.<CreateGuardedThread>b__2() in /_/src/libraries/Common/tests/System/Threading/ThreadTestHelpers.cs:line 57
   at System.Threading.Threads.Tests.ThreadTests.InterruptInFinallyBlockTest_SkipOnDesktopFramework() in /_/src/libraries/System.Threading.Thread/tests/ThreadTests.cs:line 970
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) in /_/src/mono/netcore/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.cs:line 359
----- Inner Stack Trace -----
   at System.Threading.Tests.ThreadTestHelpers.CheckedWait(WaitHandle wh) in /_/src/libraries/Common/tests/System/Threading/ThreadTestHelpers.cs:line 154
   at System.Threading.Threads.Tests.ThreadTests.<>c__DisplayClass33_0.<InterruptInFinallyBlockTest_SkipOnDesktopFramework>b__1() in /_/src/libraries/System.Threading.Thread/tests/ThreadTests.cs:line 964
----- Inner Stack Trace -----
   at System.Threading.Tests.ThreadTestHelpers.CheckedWait(WaitHandle wh) in /_/src/libraries/Common/tests/System/Threading/ThreadTestHelpers.cs:line 154
   at System.Threading.Threads.Tests.ThreadTests.<>c__DisplayClass33_0.<InterruptInFinallyBlockTest_SkipOnDesktopFramework>b__1() in /_/src/libraries/System.Threading.Thread/tests/ThreadTests.cs:line 964

https://dev.azure.com/dnceng/public/_build/results?buildId=641049&view=ms.vss-test-web.build-test-results-tab&runId=19915832&resultId=172977&paneView=debug

lambdageek commented 4 years ago

From the test:

A wait in a finally block can be interrupted. The .NET Framework applies the same rules as thread abort, and does not allow thread interrupt in a finally block. There is nothing special about thread interrupt that requires not allowing it in finally blocks, so this behavior has changed in .NET Core.

netcore Mono needs to be updated to the new behavior

SamMonoRT commented 3 years ago

Moving to 7.0.0