Search Issue Tracker

Won't Fix

Votes

0

Found in

2019.4

2020.3

2020.3.13f1

2021.1

2021.2

2022.1

Issue ID

1354775

Regression

No

Multiple errors appear in the Console when building for IL2CPP

IL2CPP

-

How to reproduce:
1. Open the user's attached project
2. Build the project for IL2CPP
3. Observe the Console

Expected result: There are no visible errors present
Actual result: Multiple errors appear in the Console

Reproducible with: 2019.4.29f1, 2020.3.15f2, 2021.1.16f1, 2021.2.0b6, 2022.1.0a4

Notes:
- The issue doesn't reproduce when the Scripting Backend is set to Mono
- In 2019.4 and 2020.3 the following error appears in the Console:
Exception: IL2CPP error (no further information about what managed code was being converted is available)
System.InvalidCastException: Unable to cast object of type 'Mono.Cecil.MethodReference' to type 'Mono.Cecil.GenericInstanceMethod'.
at Unity.IL2CPP.Metadata.PerAssemblyCodeMetadataWriter.HandleRgctxKeyNotFoundException(ReadOnlyContext context, RGCTXEntry rgctxEntry, KeyNotFoundException e)
at Unity.IL2CPP.Metadata.PerAssemblyCodeMetadataWriter.<>c__DisplayClass8_0.<WriteRGCTXValues>b__0(RGCTXEntry rgctxEntry)
at System.Linq.Enumerable.SelectIListIterator`2.ToArray()
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Unity.IL2CPP.CodeWriters.CodeWriterExtensions.WriteArrayInitializer(ICodeWriter writer, String type, String variableName, IEnumerable`1 values, Boolean externArray, Boolean nullTerminate)
at Unity.IL2CPP.Metadata.PerAssemblyCodeMetadataWriter.WriteRGCTXValues(SourceWritingContext context, ICppCodeWriter writer, GenericContextCollection genericContextCollection, List`1 res)
at Unity.IL2CPP.Metadata.PerAssemblyCodeMetadataWriter.Write(SourceWritingContext context, AssemblyDefinition assembly, GenericContextCollection genericContextCollection, String assemblyMetadataRegistrationVarName, String codeRegistrationVarName)
at Unity.IL2CPP.AssemblyConversion.SecondaryWrite.Steps.PerAssembly.WritePerAssemblyCodeMetadata.ProcessItem(GlobalWriteContext context, AssemblyDefinition item)
at Unity.IL2CPP.AssemblyConversion.Steps.Base.ScheduledItemsStepFuncWithContinueAction`3.WorkerWrapper(WorkItemData`3 workerData)
at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.ContinueWithResultsWorkItem`4.InvokeWorker(Object context, Int32 uniqueId)
at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.BaseContinueWorkItem`2.Invoke(Object context, Int32 uniqueId)
at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler`1.WorkerLoop(Object data)
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditorInternal.IL2CPPBuilder.Run () (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at <44c3723143904fb88deebc993c7bb491>:0)
DesktopStandalonePostProcessor.RunIL2CPP (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, System.Collections.Generic.List`1[T] cppPlugins) (at <44c3723143904fb88deebc993c7bb491>:0)
DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet`1[T] filesToNotOverwrite) (at <44c3723143904fb88deebc993c7bb491>:0)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <44c3723143904fb88deebc993c7bb491>:0)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <44c3723143904fb88deebc993c7bb491>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

- In 2021.2 and above the error changes to:
BuildFailedException: Incremental Player build failed!
UnityEditor.Modules.BeeBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at <991b2b0c3b89400a982fc1788acb93dc>:0)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <991b2b0c3b89400a982fc1788acb93dc>:0)
UnityEditor.WindowsStandalone.WinPlayerPostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at C:/buildslave/unity/build/PlatformDependent/WinPlayer/Extensions/Managed/WinPlayerPostProcessor.cs:33)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.Int32 subtarget, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <991b2b0c3b89400a982fc1788acb93dc>:0)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

  1. Resolution Note (2022.1.X):

    This project bumps up against the AOT compilation limit for nested recursive generics, so IL2CPP cannot currently convert this code.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.