Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
joperezr opened this issue Feb 19, 2021 · 1 comment · Fixed by #48710
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript bug linkable-framework Issues associated with delivering a linker friendly framework
Milestone

Comments

@joperezr
Copy link
Member

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

@joperezr joperezr added bug arch-wasm WebAssembly architecture linkable-framework Issues associated with delivering a linker friendly framework area-Interop-mono area-System.Runtime.InteropServices.JavaScript labels Feb 19, 2021
@joperezr joperezr added this to the 6.0.0 milestone Feb 19, 2021
@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Feb 19, 2021
@ghost
Copy link

ghost commented Feb 19, 2021

Tagging subscribers to 'linkable-framework': @eerhardt, @vitek-karas, @LakshanF, @tannergooding, @sbomer
See info in area-owners.md if you want to be subscribed.

Issue Details

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

Author: joperezr
Assignees: -
Labels:

arch-wasm, area-Interop-mono, area-System.Runtime.InteropServices.JavaScript, bug, linkable-framework

Milestone: 6.0.0

@marek-safar marek-safar removed the untriaged New issue has not been triaged by the area owner label Feb 23, 2021
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Feb 24, 2021
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Feb 25, 2021
@ghost ghost locked as resolved and limited conversation to collaborators Mar 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
arch-wasm WebAssembly architecture area-System.Runtime.InteropServices.JavaScript bug linkable-framework Issues associated with delivering a linker friendly framework
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants