There is an ongoing effort to better understand the failures encountered when running wasm library tests with AOT compilation on CI. In the past week, this error #49717 began surfacing. In an attempt to reproduce #49717 and figuring out the scope, now this error is being hit.
This error has been seen in System.Buffers.Tests.csproj, Common.Tests.csproj, and System.ComponentModel.TypeConverter.Tests.csproj with RunAOTCompilation=true (regardless of the value of EnableAggressiveTrimming). When RunAOTCompilation=false (regardless of the value of EnableAggressiveTrimming, the tests run to completion with no failures.
Error
XHarness command issued: wasm test --app=. --engine=V8 --engine-arg=--stack-trace-limit=1000 --js-file=runtime.js --output-directory=/Users/mdhwang/steveisok/artifacts/bin/System.Buffers.Tests/net6.0-Release/browser-wasm/AppBundle/xharness-output -- --run WasmTestRunner.dll System.Buffers.Tests.dll -notrait category=OuterLoop -notrait category=failing
info: 13:34:34.5702650 Running v8 --expose_wasm --stack-trace-limit=1000 runtime.js -- --run WasmTestRunner.dll System.Buffers.Tests.dll -notrait category=OuterLoop -notrait category=failing
fail: 13:34:35.6904480 console.error: System.AggregateException: One or more errors occurred. (Specified cast is not valid.)
fail: 13:34:35.6906540 ---> System.InvalidCastException: Specified cast is not valid.
fail: 13:34:35.6906640 at Xunit.Sdk.ReflectionAttributeInfo.GetNamedArgument[Int32](String argumentName)
fail: 13:34:35.6906680 --- End of stack trace from previous location ---
fail: 13:34:35.6906700 at Xunit.Sdk.ReflectionAttributeInfo.GetNamedArgument[Int32](String argumentName)
fail: 13:34:35.6906830 --- End of stack trace from previous location ---
fail: 13:34:35.6906850 at Xunit.Sdk.ReflectionAttributeInfo.GetNamedArgument[Int32](String argumentName)
fail: 13:34:35.6906870 --- End of inner exception stack trace ---
info: console.info: Arguments: --run,WasmTestRunner.dll,System.Buffers.Tests.dll,-notrait,category=OuterLoop,-notrait,category=failing
info: console.debug: MONO_WASM: Initializing mono runtime
info: console.debug: MONO_WASM: ICU data archive(s) loaded, disabling invariant mode
info: console.debug: mono_wasm_runtime_ready fe00e07a-5519-4dfe-b35a-f867dbaf2e28
info: console.info: Initializing.....
info: Discovering: System.Buffers.Tests.dll (method display = ClassAndMethod, method display options = None)
info: 13:34:35.7234490 Process v8 exited with 1
fail: Application has finished with exit code 1 but 0 was expected
XHarness exit code: 71 (GENERAL_FAILURE)
XHarness artifacts: /Users/mdhwang/steveisok/artifacts/bin/System.Buffers.Tests/net6.0-Release/browser-wasm/AppBundle/xharness-output
/Users/mdhwang/steveisok/eng/testing/tests.targets(117,5): error : One or more tests failed while running tests from 'System.Buffers.Tests'. [/Users/mdhwang/steveisok/src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj]
Repro
Running library tests on Browser wasm based on 4e3deb5
Make the following changes to prevent linking out xunit related assemblies and skip an exception filter error with AOT compilation.
mdhwang:~/runtime_wasm_clean$ git diff
diff --git a/eng/testing/ILLink.Descriptor.xunit.xml b/eng/testing/ILLink.Descriptor.xunit.xml
index 4ddd4e09d88..c137141b171 100644
--- a/eng/testing/ILLink.Descriptor.xunit.xml
+++ b/eng/testing/ILLink.Descriptor.xunit.xml
@@ -9,7 +9,15 @@
</type>
<type fullname="Xunit.Sdk.FactDiscoverer" />
</assembly>
- <assembly fullname="xunit.core">
- <namespace fullname="Xunit" />
+ <assembly fullname="xunit.core"/>
+ <assembly fullname="Microsoft.DotNet.XUnitExtensions"/>
+ <assembly fullname="mscorlib" />
+ <assembly fullname="TestUtilities">
+ <namespace fullname="System" />
</assembly>
+ <assembly fullname="xunit.abstractions" />
+ <assembly fullname="xunit.assert" />
+ <assembly fullname="xunit.runner.utility.netcoreapp10" />
+ <assembly fullname="Microsoft.DotNet.XHarness.TestRunners.Xunit" />
+ <assembly fullname="Microsoft.DotNet.XHarness.TestRunners.Common" />
</linker>
diff --git a/src/libraries/System.Private.CoreLib/src/System/IO/LegacyFileStreamStrategy.Unix.cs b/src/libraries/System.Private.CoreLib/src/System/IO/LegacyFileStreamStrategy.Unix.cs
index 26818014bbb..45907d37104 100644
--- a/src/libraries/System.Private.CoreLib/src/System/IO/LegacyFileStreamStrategy.Unix.cs
+++ b/src/libraries/System.Private.CoreLib/src/System/IO/LegacyFileStreamStrategy.Unix.cs
@@ -172,7 +172,7 @@ protected override void Dispose(bool disposing)
{
FlushWriteBuffer();
}
- catch (Exception e) when (!disposing && FileStream.IsIoRelatedException(e))
+ catch
{
// On finalization, ignore failures from trying to flush the write buffer,
// e.g. if this stream is wrapping a pipe and the pipe is now broken.
./build.sh -os Browser -arch wasm -c Release
./dotnet.sh build /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release /p:EnableAggressiveTrimming=true /p:RunAOTCompilation=true src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj
There is an ongoing effort to better understand the failures encountered when running wasm library tests with AOT compilation on CI. In the past week, this error #49717 began surfacing. In an attempt to reproduce #49717 and figuring out the scope, now this error is being hit.
This error has been seen in
System.Buffers.Tests.csproj,Common.Tests.csproj, andSystem.ComponentModel.TypeConverter.Tests.csprojwithRunAOTCompilation=true(regardless of the value ofEnableAggressiveTrimming). WhenRunAOTCompilation=false(regardless of the value ofEnableAggressiveTrimming, the tests run to completion with no failures.Error
Repro
Running library tests on Browser wasm based on 4e3deb5
Make the following changes to prevent linking out xunit related assemblies and skip an exception filter error with AOT compilation.
./build.sh -os Browser -arch wasm -c Release./dotnet.sh build /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release /p:EnableAggressiveTrimming=true /p:RunAOTCompilation=true src/libraries/System.Buffers/tests/System.Buffers.Tests.csproj