Skip to content

iOS/AOT: XmlSerializer.Deserialize throws Attempting to JIT compile method 'void Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract:.ctor ()' while running in aot-only mode. #56533

@rolfbjarne

Description

@rolfbjarne

Description

Calling XmlSerializer.Deserialize ends up throwing a System.ExecutionEngineException: "Attempting to JIT compile method 'void Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract:.ctor ()' while running in aot-only mode."

EXCEPTION: System.InvalidOperationException: XmlSerializeErrorDetails, 0, 0
 ---> System.ExecutionEngineException: Attempting to JIT compile method 'void Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializerContract:.ctor ()' while running in aot-only mode. See https://docs.microsoft.com/xamarin/ios/internals/limitations for more information.
   at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object , Object[] , Boolean ) in System.Private.CoreLib.dll:token 0x600269a+0x5
   Exception_EndOfInnerExceptionStack
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader , String , XmlDeserializationEvents ) in System.Private.Xml.dll:token 0x6001b05+0x10d
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader , String ) in System.Private.Xml.dll:token 0x6001b04+0x0
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader ) in System.Private.Xml.dll:token 0x6001b02+0x0
   at MySimpleApp.Program.XmlSerializationTest.Response.Deserialize(String xml) in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:line 67
   at MySimpleApp.Program.XmlSerializationTest.Bug1820_GenericList() in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:line 184
   at MySimpleApp.Program.Main(String[] args) in /Users/rolf/work/maccore/main/xamarin-macios/tests/dotnet/MySimpleApp/AppDelegate.cs:line 22

Test code: https://github.com/rolfbjarne/xamarin-macios/blob/c8014a6b6fd759159b409df19062f11b57ae8e2c/tests/dotnet/MySimpleApp/AppDelegate.cs#L21-L187

To reproduce:

  1. Download & install Xcode 13 beta 3.

  2. Clone my fork of xamarin-macios, and checkout the Bug1820_GenericList-testcase branch, and build it:

     git clone https://github.com/rolfbjarne/xamarin-macios
     git checkout Bug1820_GenericList-testcase
     cd xamarin-macios
     ./configure --enable-dotnet --enable-xamarin
     make reset
     make all -j8
     make install -j8
    
  3. Connect an iOS device

  4. Build & run the test project:

     make -C tests/dotnet/MySimpleApp/iOS run-dev
    

Configuration

6.0.100-rc.1.21377.4

Regression?

With regards to legacy Xamarin, yes.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions