Skip to content

[wasm] System.Linq.Expressions tests fail with "System.BadImageFormatException : Method has no body" #39771

Closed

Description

@MaximLipnin

While running on Browser WASM, several System.Linq.Expressions tests, invoking Expression.Compile(true), fail with something like:

<message><![CDATA[System.BadImageFormatException : Method has no body]]></message>
<stack-trace><![CDATA[   at System.Delegate.CreateDelegate(Type type, Object firstArgument, MethodInfo method, Boolean throwOnBindFailure, Boolean allowClosed)
   at System.Delegate.CreateDelegate(Type type, MethodInfo method, Boolean throwOnBindFailure)
   at System.Delegate.CreateDelegate(Type type, MethodInfo method)
   at System.Reflection.RuntimeMethodInfo.CreateDelegate(Type delegateType)
   at System.Linq.Expressions.Interpreter.FuncCallInstruction`2[[System.Linq.Expressions.Tests.CallTests.Interface1, System.Linq.Expressions.Tests, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51],[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]..ctor(MethodInfo target)
   at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions)
--- End of stack trace from previous location ---
   at System.Linq.Expressions.Interpreter.ExceptionHelpers.UnwrapAndRethrow(TargetInvocationException exception)
   at System.Linq.Expressions.Interpreter.CallInstruction.SlowCreate(MethodInfo info, ParameterInfo[] pis)
   at System.Linq.Expressions.Interpreter.CallInstruction.FastCreate(MethodInfo target, ParameterInfo[] pi)
   at System.Linq.Expressions.Interpreter.CallInstruction.Create(MethodInfo info, ParameterInfo[] parameters)
   at System.Linq.Expressions.Interpreter.InstructionList.EmitCall(MethodInfo method, ParameterInfo[] parameters)
   at System.Linq.Expressions.Interpreter.LightCompiler.CompileMethodCallExpression(Expression object, MethodInfo method, IArgumentProvider arguments)
   at System.Linq.Expressions.Interpreter.LightCompiler.CompileMethodCallExpression(Expression expr)
   at System.Linq.Expressions.Interpreter.LightCompiler.CompileNoLabelPush(Expression expr)
   at System.Linq.Expressions.Interpreter.LightCompiler.Compile(Expression expr)
   at System.Linq.Expressions.Interpreter.LightCompiler.CompileTop(LambdaExpression node)
   at System.Linq.Expressions.LambdaExpression.Compile(Boolean preferInterpretation)
   at System.Linq.Expressions.Tests.CallTests.Call_NoParameters(Expression instance, MethodInfo method, Object expected, Boolean useInterpreter)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)]]>
</stack-trace>
</failure>

STR:

  1. Set up prereqs to build for wasm/browser (docs)
  2. Build for wasm/browser ./build.sh --arch wasm --os Browser --configuration release
  3. Install V8 to run the library tests (docs)
  4. Run System.Linq.Expressions library test suite ./dotnet.sh build src/libraries/System.Linq.Expressions/tests/ /t:Test /p:TargetOS=Browser /p:TargetArchitecture=wasm /p:Configuration=release

Activity

  1. added this to the 5.0.0 milestone on Jul 22, 2020
  2. added
    arch-wasmWebAssembly architecture
    and removed
    untriagedNew issue has not been triaged by the area owner
    on Jul 22, 2020
  3. kg commented on Jul 28, 2020

    @kg
    Contributor

    I tried to repro this using your steps but the last one (running the test suite) fails:

      Restored /home/kate/Projects/dotnet-runtime-wasm/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj (in 4.32 sec).
    /home/kate/Projects/dotnet-runtime-wasm/.dotnet/sdk/5.0.100-preview.8.20362.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.FrameworkReferenceResolution.targets(379,5): error NETSDK1112: The runtime pack for Microsoft.NETCore.App.Runtime.browser-wasm was not downloaded. Try running a NuGet restore with the RuntimeIdentifier 'browser-wasm'. [/home/kate/Projects/dotnet-runtime-wasm/src/libraries/System.Linq.Expressions/tests/System.Linq.Expressions.Tests.csproj]
    
    Build FAILED.
    

    Did you set some environment variables to make it use the build from artifacts/?

  4. MaximLipnin commented on Jul 28, 2020

    @MaximLipnin
    ContributorAuthor

    No, I didn't set any environment variables besides EMSDK_PATH and PATH for jsvu-v8, mentioned in the docs from repro steps.

  5. MaximLipnin commented on Jul 31, 2020

    @MaximLipnin
    ContributorAuthor

    There is no repro, the tests are enabled in #40130

  6. ghost locked as resolved and limited conversation to collaborators on Dec 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions