Skip to content

Commit

Permalink
Include marshal-ilgen Mono component by default
Browse files Browse the repository at this point in the history
Context: dotnet/runtime#71203
Fixes: #7249

Apps on this PR currently crash with:

    mono-rt : [ERROR] FATAL UNHANDLED EXCEPTION: System.InvalidProgramException: Invalid IL code in (wrapper managed-to-native) object:wrapper_native_0x7725af156f10 (intptr): IL_0012: calli     0x00000003
    mono-rt :    at System.Runtime.InteropServices.Marshal.PtrToStructureHelper(IntPtr , Object , Boolean )
    mono-rt :    at System.Runtime.InteropServices.Marshal.PtrToStructure(IntPtr , Type )
    mono-rt :    at Java.Interop.JniRuntime.CreateInvoker(IntPtr )
    mono-rt :    at Java.Interop.JniRuntime..ctor(CreationOptions )
    mono-rt :    at Android.Runtime.AndroidRuntime..ctor(IntPtr , IntPtr , Boolean , IntPtr , IntPtr , Boolean )
    mono-rt :    at Android.Runtime.JNIEnv.Initialize(JnienvInitializeArgs* )

Which, I assume is due to a missing Mono component.

We should add the component by default:

    <_MonoComponent Condition=" '$(_IncludeMarshalIlGen)' != 'false' " Include="marshal-ilgen" />

In the future, someone could experiment by setting
`$(_IncludeMarshalIlGen)` to `false`.
  • Loading branch information
jonathanpeppers committed Aug 12, 2022
1 parent a64274d commit 303f41f
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ _ResolveAssemblies MSBuild target.
<_MonoComponent Condition=" '$(AndroidEnableProfiler)' == 'true' " Include="diagnostics_tracing" />
<_MonoComponent Condition=" '$(AndroidUseInterpreter)' == 'true' " Include="hot_reload" />
<_MonoComponent Condition=" '$(AndroidIncludeDebugSymbols)' == 'true' " Include="debugger" />
<_MonoComponent Condition=" '$(_IncludeMarshalIlGen)' != 'false' " Include="marshal-ilgen" />
</ItemGroup>
<ProcessNativeLibraries
InputLibraries="@(_ResolvedNativeLibraries)"
Expand Down

0 comments on commit 303f41f

Please sign in to comment.