-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
[WASM] browser-wasm tests fail with "Cannot box IsByRefLike type" #102988
Comments
Tagging subscribers to 'arch-wasm': @lewing |
Introduced by #102795 cc @AaronRobinsonMSFT @stephentoub Looks like Mono is missing byref-like generics support for some patterns. |
Presumably that particular case is due to the change from |
@stephentoub please revert for now. I'm a bit surprised there's a difference. I think the long term fix for mono is probably quick (most likely |
/cc @steveisok |
It looks like the problem is this code in Unsafe.Bitcast: if (sizeof(TFrom) != sizeof(TTo) || default(TFrom) is null || default(TTo) is null)
{
ThrowHelper.ThrowNotSupportedException();
}
return ReadUnaligned<TTo>(ref As<TFrom, byte>(ref source)); the test
and I think Mono interpreter doesn't correctly elide the boxing for the |
I have a fix, but for some reason I'm having trouble making a standalone repro. The only way I get it to fail for sure is using our "xunit on chrome" scenario when this line executes: Doing the same thing in a standalone sample doesn't cause a crash. As far as I can tell it's not due to IL differences. It might be different inlining choices in the interpreter, but I don't see how that would alter what the IL interpreter sees. very strange. Update Looks like the difference is that our unit tests run with interpreter optimizations disabled, whereas the samples have optimizations. Update2 Repro is to add this to a browser-wasm sample: string s = string.Format(CultureInfo.InvariantCulture, "version is {0}", new object[] { new Version(1,2,3,4) }); And set these project properties: <PropertyGroup>
<Optimize>false</Optimize>
<DebuggerSupport>true</DebuggerSupport>
<WasmDebugLevel>-1</WasmDebugLevel>
<DebugType>portable</DebugType>
<EmitDebugInformation>true</EmitDebugInformation>
</PropertyGroup> |
In cases where we don't do cprop and deadce (for example if ~mono_interp_opt~ is 0 because we're debugging) don't emit a box_vt opcode before a branch. Instead just emit a constant true Fixes dotnet#102988
…s up front (#103052) * [interp] handle box + brtrue/brfalse pattern for byreflike types In cases where we don't do cprop and deadce (for example if `mono_interp_opt` is 0 because we're debugging) don't emit a box_vt opcode before a branch. Instead just emit a constant true Fixes #102988 * Revert "Revert uses of Unsafe.BitCast with spans to unblock mono (#102998)" This reverts commit c286a8e. Reverts #102998 * remove the box byreflike retry code we handle box byreflike code patterns directly now * handle box;isinst;{brtrue|brfalse|unbox.any} IL patterns * Add test locking down mismatched box;isinst;unbox.any pattern * remove the mismatch case in the interp. throw IPE at execution time * Update src/tests/Loader/classloader/generics/ByRefLike/Validate.cs Co-authored-by: Aaron Robinson <arobins@microsoft.com> --------- Co-authored-by: Aaron Robinson <arobins@microsoft.com>
Build Information
Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=695082
Build error leg or test failing: Build browser-wasm linux Release LibraryTests_Threading
Error Message
Fill the error message using step by step known issues guidance.
Known issue validation
Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=695082
Error message validated:
[System.InvalidProgramException.*Cannot box IsByRefLike type
]Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 6/3/2024 6:16:35 PM UTC
Report
Summary
The text was updated successfully, but these errors were encountered: