Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mono] Failure at System.Reflection.Emit.DynamicMethod.CreateDelegate, attempting to JIT compile method while in aot-only mode. #104431

Open
matouskozak opened this issue Jul 4, 2024 · 4 comments
Labels
area-Codegen-AOT-mono blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab os-ios Apple iOS os-maccatalyst MacCatalyst OS
Milestone

Comments

@matouskozak
Copy link
Member

matouskozak commented Jul 4, 2024

Build Information

Build: https://dev.azure.com/dnceng-public/public/_build/results?buildId=789085
Build error leg or test failing: iOS.Simulator.LambdaCompilerAot.Test
Affected CI: maccatalyst_[x64/arm64]_release_allsubsets_mono, iossimulator_x64_release_allsubsets_mono (runtime-extra-platforms)
Range of commits: 42ade70...ceb0a16

Stack trace example from iOSSimulator job:

2024-07-03 19:34:42.254 I  iOS.Simulator.LambdaCompilerAot.Test[455:11b63a] Unhandled managed exceptions:
Attempting to JIT compile method '(wrapper dynamic-method) string object:lambda_method1 (System.Runtime.CompilerServices.Closure)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
 (System.ExecutionEngineException)
   at System.Delegate.CreateDelegate(Type , Object , MethodInfo , Boolean , Boolean )
   at System.Delegate.CreateDelegate(Type , Object , MethodInfo , Boolean )
   at System.Delegate.CreateDelegate(Type , Object , MethodInfo )
   at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type , Object )
   at System.Linq.Expressions.Compiler.LambdaCompiler.CreateDelegate()
   at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression )
   at System.Linq.Expressions.Expression`1[[System.Func`1[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Compile()
   at System.Linq.EnumerableExecutor`1[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].Execute()
   at System.Linq.EnumerableQuery`1[[System.String, System.Private.CoreLib, Version=9.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].System.Linq.IQueryProvider.Execute[String](Expression )
   at System.Linq.Queryable.First[String](IQueryable`1 source)
   at Program.Main(String[] )
   at Program.<Main>(String[] )
2024-07-03 19:34:42.255 I  iOS.Simulator.LambdaCompilerAot.Test[455:11b63a] DOTNET.APP_EXIT_CODE: 1
[15:14:11] dbug: Attempting to JIT compile method '(wrapper dynamic-method) void object:WriteArrayOfintToXml (System.Runtime.Serialization.XmlWriterDelegator,object,System.Runtime.Serialization.XmlObjectSerializerWriteContext,System.Runtime.Serialization.DataContracts.CollectionDataContract)' while running in aot-only mode. See https://learn.microsoft.com/xamarin/ios/internals/limitations for more information.
[15:14:11] dbug: (System.ExecutionEngineException)
[15:14:11] dbug: at System.Delegate.CreateDelegate(Type , Object , MethodInfo , Boolean , Boolean )
[15:14:11] dbug: at System.Delegate.CreateDelegate(Type , Object , MethodInfo , Boolean )
[15:14:11] dbug: at System.Delegate.CreateDelegate(Type , Object , MethodInfo )
[15:14:11] dbug: at System.Reflection.Emit.DynamicMethod.CreateDelegate(Type )
[15:14:11] dbug: at System.Runtime.Serialization.CodeGenerator.EndMethod()
[15:14:11] dbug: at System.Runtime.Serialization.XmlFormatWriterGenerator.CriticalHelper.GenerateCollectionWriter(CollectionDataContract )
[15:14:11] dbug: at System.Runtime.Serialization.XmlFormatWriterGenerator.GenerateCollectionWriter(CollectionDataContract )
[15:14:11] dbug: at System.Runtime.Serialization.DataContracts.CollectionDataContract.CreateXmlFormatWriterDelegate()
[15:14:11] dbug: at System.Runtime.Serialization.DataContracts.CollectionDataContract.get_XmlFormatWriterDelegate()
[15:14:11] dbug: at System.Runtime.Serialization.DataContracts.CollectionDataContract.WriteXmlValue(XmlWriterDelegator , Object , XmlObjectSerializerWriteContext )
[15:14:11] dbug: at System.Runtime.Serialization.XmlObjectSerializerWriteContext.WriteDataContractValue(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle declaredTypeHandle)
[15:14:11] dbug: at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeAndVerifyType(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, Boolean verifyKnownType, RuntimeTypeHandle declaredTypeHandle, Type declaredType)
[15:14:11] dbug: at System.Runtime.Serialization.XmlObjectSerializerWriteContext.SerializeWithXsiTypeAtTopLevel(DataContract dataContract, XmlWriterDelegator xmlWriter, Object obj, RuntimeTypeHandle originalDeclaredTypeHandle, Type graphType)
[15:14:11] dbug: at System.Runtime.Serialization.DataContractSerializer.InternalWriteObjectContent(XmlWriterDelegator , Object , DataContractResolver )
[15:14:11] dbug: at System.Runtime.Serialization.DataContractSerializer.InternalWriteObject(XmlWriterDelegator , Object , DataContractResolver )
[15:14:11] dbug: at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator , Object , DataContractResolver )
[15:14:11] dbug: at System.Runtime.Serialization.XmlObjectSerializer.WriteObjectHandleExceptions(XmlWriterDelegator , Object )
[15:14:11] dbug: at System.Runtime.Serialization.DataContractSerializer.WriteObject(XmlWriter , Object )
[15:14:11] dbug: at Program.Main(String[] )
[15:14:11] dbug: at Program.<Main>(String[] )

Error Message

Fill the error message using step by step known issues guidance.

{
  "ErrorPattern": "at System.Reflection.Emit.DynamicMethod.CreateDelegate",
  "BuildRetry": false,
  "ExcludeConsoleLog": false
}

Known issue validation

Build: 🔎 https://dev.azure.com/dnceng-public/public/_build/results?buildId=789085
Error message validated: [at System.Reflection.Emit.DynamicMethod.CreateDelegate]
Result validation: ✅ Known issue matched with the provided build.
Validation performed at: 8/27/2024 9:26:47 AM UTC

Report

Build Definition Test Pull Request
811886 dotnet/runtime WasmTestOnChrome-MT-System.Runtime.Serialization.Xml.Tests.WorkItemExecution #107980
804204 dotnet/runtime iOS.Simulator.XmlFormatWriterGeneratorAot.Test.WorkItemExecution
800429 dotnet/runtime iOS.Simulator.XmlFormatWriterGeneratorAot.Test.WorkItemExecution
794325 dotnet/runtime iOS.Simulator.XmlFormatWriterGeneratorAot.Test.WorkItemExecution
793084 dotnet/runtime iOS.Simulator.XmlFormatWriterGeneratorAot.Test.WorkItemExecution
789085 dotnet/runtime iOS.Simulator.XmlFormatWriterGeneratorAot.Test.WorkItemExecution
786206 dotnet/runtime iOS.Simulator.XmlFormatWriterGeneratorAot.Test.WorkItemExecution
784159 dotnet/runtime iOS.Simulator.LambdaCompilerAot.Test.WorkItemExecution

Summary

24-Hour Hit Count 7-Day Hit Count 1-Month Count
0 1 8
@matouskozak matouskozak added blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' untriaged New issue has not been triaged by the area owner area-Codegen-AOT-mono os-ios Apple iOS os-maccatalyst MacCatalyst OS Known Build Error Use this to report build issues in the .NET Helix tab labels Jul 4, 2024
Copy link
Contributor

Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Tagging subscribers to 'os-maccatalyst': @vitek-karas, @kotlarmilos, @ivanpovazan, @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

@matouskozak
Copy link
Member Author

Could it be introduced by #103777 @steveisok or does the change only affected NAOT?

@steveisok
Copy link
Member

Could it be introduced by #103777 @steveisok or does the change only affected NAOT?

It only impacted nativeaot. It was really specific. If you had the mono library builder workload installed and you tried to build a static/shared library with nativeaot, you couldn't.

@vitek-karas vitek-karas added this to the 9.0.0 milestone Jul 25, 2024
@dotnet-policy-service dotnet-policy-service bot removed the untriaged New issue has not been triaged by the area owner label Jul 25, 2024
@matouskozak matouskozak changed the title [mono] Failure LambdaCompilerAot tests due to attempts of JIT compiling method while in aot-only mode. [mono] Failure at System.Reflection.Emit.DynamicMethod.CreateDelegate, attempting to JIT compile method while in aot-only mode. Aug 27, 2024
@vitek-karas vitek-karas modified the milestones: 9.0.0, 10.0.0 Sep 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-Codegen-AOT-mono blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' Known Build Error Use this to report build issues in the .NET Helix tab os-ios Apple iOS os-maccatalyst MacCatalyst OS
Projects
None yet
Development

No branches or pull requests

3 participants