Skip to content

[wasm] EnableAggressiveTrimming causing failing tests - System.Diagnostics.Tests.ActivityTest #46768

@mdh1418

Description

@mdh1418

In effort to run library tests with AOT compilation on CI #46633, there are a number of failures arising from #46651.

Test suite System.Diagnostics.DiagnosticSource/tests/TestWithConfigSwitches/System.Diagnostics.DiagnosticSource.Switches.Tests.csproj fails with

  fail: [FAIL] System.Diagnostics.Tests.ActivityTests.ActivityIdNonHierarchicalOverflow
  info: Assert.InRange() Failure
  info: Range:  (55 - 56)
  info: Actual: 27
  info:
  fail: [FAIL] System.Diagnostics.Tests.ActivityTests.IdFormat_ZeroTraceIdAndSpanIdWithHierarchicalFormat
  info: Assert.Equal() Failure
  info: Expected: Hierarchical
  info: Actual:   W3C
  info:
  fail: [FAIL] System.Diagnostics.Tests.ActivityTests.IdFormat_HierarchicalIsDefault
  info: Assert.Equal() Failure
  info: Expected: Hierarchical
  info: Actual:   W3C
  info:
  fail: [FAIL] System.Diagnostics.Tests.ActivityTests.IdGenerationInternalParent
  info: System.PlatformNotSupportedException : Cannot wait on monitors on this runtime.
  info:
  info: Finished:    System.Diagnostics.DiagnosticSource.Switches.Tests.dll

System_diagnostics_diagnosticsource_switches_fail.txt

Repro:
Check out changes in #46651
./build.sh -os Browser -arch wasm -c Release
Remove

<!-- Temporary until https://github.com/mono/linker/issues/1713 is resolved -->
<assembly fullname="Microsoft.DotNet.RemoteExecutor">
<type fullname="Microsoft.DotNet.RemoteExecutor.Program">
<method signature="System.Int32 Main(System.String[])" />
</type>
</assembly>

Modify
catch (Exception e) when (IsIoRelatedException(e) && !disposing)
to be an empty catch

catch
{
}

./dotnet.sh build /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=Release /p:EnableAggressiveTrimming=true /p:RunAOTCompilation=true src/libraries/System.Diagnostics.DiagnosticSource/tests/TestWithConfigSwitches/System.Diagnostics.DiagnosticSource.Switches.Tests.csproj

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions