dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 508 forks source link

Wasm: EqualityComparer<T> failure #8321

Closed yowl closed 4 years ago

yowl commented 4 years ago

The following code fails in the Wasm backend:

internal static class Assert
{
    public static void Equal<T>(T expected, T actual)
    {
        if (EqualityComparer<T>.Default.Equals(expected, actual))
            return;
        Program.PrintLine("Assertion failure - Assert.Equal " + expected.ToString() + "," +  actual.ToString());
        throw new Exception();
    }
}

called with

 Assert.Equal(true, true);

The exception is thrown instead of returning at the return.

Assertion failure - Assert.Equal True,True
exception thrown: 7190224