Skip to content

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

@MaximLipnin

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions