You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Mono] Test failed on windows: System.Collections.Concurrent.Tests.BlockingCollectionTests.Test_LargeSize_STA #34360
System.Collections.Concurrent.Tests.BlockingCollectionTests.Test_LargeSize_STA is disabled in Mono's CoreFX.issues_windows.rsp file. After enabling it still fails locally with the following output:
System.Collections.Concurrent.Tests.BlockingCollectionTests.Test_LargeSize_STA [FAIL]
System.InvalidOperationException : Failed to set the specified COM apartment state.
Stack Trace:
_\src\libraries\System.Private.CoreLib\src\System\Threading\Thread.cs(234,0): at System.Threading.Thread.SetApartmentState(ApartmentState state)
_\src\libraries\System.Collections.Concurrent\tests\BlockingCollectionTests.cs(985,0): at System.Collections.Concurrent.Tests.BlockingCollectionTests.Test_LargeSize_STA()
_\src\mono\netcore\System.Private.CoreLib\src\System\Reflection\RuntimeMethodInfo.cs(360,0): at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
The test will be marked with ActiveIssue in #32592.
@danmosemsft issues like this one are not Mono specific. They have wrong conditional facts, it should be IsCOMSupported or something similar instead of nameof(PlatformDetection.IsNotWindowsNanoServer)
Can your team help with cleaning up the wrong facts?
In general I don’t think it makes sense to do much of this cleanup “blind” where we can’t see the result of what we did.
There is about 140 tests disabled with PlatformDetection.IsNotWindowsNanoServer. I very much doubt many if all of them are really Nano Server specific and not disabled .NET features. Using the correct condition would help us to see which tests are real failures on new .NET5 platforms so this is not going blind but categorize libraries tests exclusion correctly.
That said what is the issue in this case? The test is annotated because Windows Nano Server does not support creating STA threads. Is that not supported on Mono period? I do see it rejected in the mono corelib
but I also see code in the Mono runtime for STA thread. Is there a Mono limitation that it cannot change apartment state? If so should we decide whether that should be fixed? That would tell us whether we need a test like PlatformDetection.SupportsChangingApartmentState or it's just a bug.
In general, MonoVM does not support COM on any platform. Whether it's better to exclude this test with feature described as COM or smaller one is one of the reasons why I think your team would be better to handle this as they have a broader view on all possible combinations.
// Mono does not support COM Interop, even setting thread apartment state
public static bool IsComSupported => IsWindows && !IsMonoRuntime;
public static bool IsNotComSupported => !IsComInteropSupported;
Activity
marek-safar commentedon Apr 8, 2020
@danmosemsft issues like this one are not Mono specific. They have wrong conditional facts, it should be
IsCOMSupportedor something similar instead ofnameof(PlatformDetection.IsNotWindowsNanoServer)Can your team help with cleaning up the wrong facts?
danmoseley commentedon Apr 8, 2020
Would it make sense for @MaximLipnin to make that small change?
In general I don’t think it makes sense to do much of this cleanup “blind” where we can’t see the result of what we did.
marek-safar commentedon Apr 8, 2020
There is about 140 tests disabled with
PlatformDetection.IsNotWindowsNanoServer. I very much doubt many if all of them are really Nano Server specific and not disabled .NET features. Using the correct condition would help us to see which tests are real failures on new .NET5 platforms so this is not going blind but categorize libraries tests exclusion correctly.danmoseley commentedon Apr 8, 2020
Yes, I agree it would be better for many of those to be replaced with capability tests eg., like this pattern
We can and should do that where possible
That said what is the issue in this case? The test is annotated because Windows Nano Server does not support creating STA threads. Is that not supported on Mono period? I do see it rejected in the mono corelib
runtime/src/mono/netcore/System.Private.CoreLib/src/System/Threading/Thread.Mono.cs
Line 302 in 5cd7e97
but I also see code in the Mono runtime for STA thread. Is there a Mono limitation that it cannot change apartment state? If so should we decide whether that should be fixed? That would tell us whether we need a test like
PlatformDetection.SupportsChangingApartmentStateor it's just a bug.danmoseley commentedon Apr 8, 2020
I also see that Thread.Mono.cs will never report anything other than ApartmentState.Unknown.
marek-safar commentedon Apr 9, 2020
In general, MonoVM does not support COM on any platform. Whether it's better to exclude this test with feature described as COM or smaller one is one of the reasons why I think your team would be better to handle this as they have a broader view on all possible combinations.
danmoseley commentedon Apr 10, 2020
OK. Then we should add in PlatformDetection.cs
and conditionalize tests here and those listed in
#34442
#34685
#34689
I didn't distinguish COM interop from setting thread apartment since they generally go together/
eiriktsarpalis commentedon Aug 12, 2021
Moving to 7.0.0