Skip to content

System.Runtime.InteropServices.Javascript is getting trimmed out in some cases for browser-wasm #48522

Closed

Description

@joperezr

When trying to enable the linker Trimming Tests to run on browser-wasm, we found that some tests would fail due to the fact that System.Runtime.InteropServices.Javascript.dll is not getting preserved correctly when the app is built, causing runtime crashes when the test needs to marshal some types. One example of a test case that fails is GenericArraySortHelperTest which passes just fine if we manually root the IS.Javascript.dll, but if we remove that workaround the test fails with:

root@168370dbdf5c:/home/joperezr/share/runtime/artifacts/bin/trimmingTests/projects/System.Runtime.TrimmingTests/GenericArraySortHelperTest/browser-wasm/bin/Release/net6.0/browser-wasm/AppBundle# ./run-v8.sh
Arguments: --run,project.dll
console.debug: MONO_WASM: Initializing mono runtime
console.debug: MONO_WASM: ICU data archive(s) loaded, disabling invariant mode
WASM-ERR: [ERROR] FATAL UNHANDLED EXCEPTION: Nested exception detected.
WASM-ERR: Original Exception: at System.Collections.Generic.Dictionary`2<string, object>..ctor (int,System.Collections.Generic.IEqualityComparer`1<string>) <0x00060>
WASM-ERR: at System.Collections.Generic.Dictionary`2<string, object>..ctor (int) <0x00014>
WASM-ERR: at System.AppContext.Setup (char**,char**,int) <0x00016>
WASM-ERR:
WASM-ERR: Nested exception:at System.RuntimeType.get_BaseType () <0x00056>
WASM-ERR: at System.Type.IsSubclassOf (System.Type) <0x00044>
WASM-ERR: at System.Reflection.CustomAttribute.IsDefined (System.Reflection.ICustomAttributeProvider,System.Type,bool) <0x00040>
WASM-ERR: at System.Reflection.RuntimeMethodInfo.IsDefined (System.Type,bool) <0x00016>
WASM-ERR: at System.Diagnostics.StackTrace.ShowInStackTrace (System.Reflection.MethodBase) <0x00048>
WASM-ERR: at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat,System.Text.StringBuilder) <0x000c8>
WASM-ERR: at System.Diagnostics.StackTrace.ToString (System.Diagnostics.StackTrace/TraceFormat) <0x00036>
WASM-ERR: at System.Exception.GetStackTrace (bool) <0x0006a>
WASM-ERR: at System.Exception.get_StackTrace () <0x0000e>
WASM-ERR: at System.Exception.ToString () <0x000ae>
WASM-ERR: at System.Exception.ToString () <0x00054>
WASM-ERR:
WASM-ERR:

PR #48429 is adding a workaround for now which is rooting System.Runtime.InteropServices.Javascript.dll for the browser-wasm trimming tests so that we can have all tests running and passing, but this workaround should be removed once the underlying problem is fixed.

cc: @marek-safar @eerhardt @lewing

Activity

  1. added
    arch-wasm
    linkable-framework
    on Feb 19, 2021
  2. added this to the 6.0.0 milestone on Feb 19, 2021
  3. ghost added
    untriaged
    on Feb 19, 2021
  4. removed
    untriaged
    on Feb 23, 2021
  5. ghost added
    in-pr
    on Feb 24, 2021
  6. ghost removed
    in-pr
    on Feb 25, 2021
  7. ghost locked as resolved and limited conversation to collaborators on Mar 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    arch-wasmarea-System.Runtime.InteropServices.JavaScriptbuglinkable-framework

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions