Exception: IL2CPP error for method 'System.Void Unity.GeneratedNetworkCode::_WriteArrayInt32_None

1.-

IL2CPP error (no further information about what managed code was being converted is available)
Unity.IL2CPP.HashCodeCollisionException: Hash code collision on value 483E6DDCA003A8CEBD350443456C4F5FB7439B58
Existing Item was : System.Void Unity.GeneratedNetworkCode::_WriteArrayInt32_None(UnityEngine.Networking.NetworkWriter,System.Int32[ ])
Colliding Item was : System.Void Unity.GeneratedNetworkCode::_WriteArrayInt32_None(UnityEngine.Networking.NetworkWriter,System.Int32[ ])
at Unity.IL2CPP.HashCodeCache1.GetUniqueHash(T value) at Unity.IL2CPP.Naming.NamingComponent.ForMethodInternal(MethodReference method) at Unity.IL2CPP.Naming.NamingComponent.ForMethodNameOnly(MethodReference method) at Unity.IL2CPP.AssemblyConversion.PrimaryCollection.Steps.Global.WarmNamingComponent.ProcessItem(GlobalPrimaryCollectionContext context, AssemblyDefinition item, Object globalState) at Unity.IL2CPP.AssemblyConversion.Steps.Base.GlobalScheduledStepAction2.ProcessAllItems(TWorkerContext context, ReadOnlyCollection1 items) at Unity.IL2CPP.AssemblyConversion.Steps.Base.GlobalScheduledStepAction2.WorkerWrapper(WorkItemData3 workerData) at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler1.WorkerLoop(Object data)

2.-

Exception: IL2CPP error for method ‘System.Void Unity.GeneratedNetworkCode::_WriteArrayInt32_None(UnityEngine.Networking.NetworkWriter,System.Int32[ ])’ in assembly ‘C:\Users\Michc\Documents\Ads Creator Client export\Temp\StagingArea\assets\bin\Data\Managed\Assembly-CSharp.dll’
Unity.IL2CPP.HashCodeCollisionException: Hash code collision on value 483E6DDCA003A8CEBD350443456C4F5FB7439B58
Existing Item was : System.Void Unity.GeneratedNetworkCode::_WriteArrayInt32_None(UnityEngine.Networking.NetworkWriter,System.Int32[ ])
Colliding Item was : System.Void Unity.GeneratedNetworkCode::_WriteArrayInt32_None(UnityEngine.Networking.NetworkWriter,System.Int32[ ])
at Unity.IL2CPP.HashCodeCache1.GetUniqueHash(T value) at Unity.IL2CPP.Naming.NamingComponent.ForMethodInternal(MethodReference method) at Unity.IL2CPP.Naming.NamingComponent.ForMethodNameOnly(MethodReference method) at Unity.IL2CPP.Attributes.AttributeNamingExtensions.ForCustomAttributesCacheGenerator(INamingService naming, MethodDefinition methodDefinition) at Unity.IL2CPP.Attributes.AttributeSupportCollector.Add(MethodDefinition methodDefinition) at Unity.IL2CPP.Attributes.AttributeSupportCollector.Collect(TypeDefinition type) at Unity.IL2CPP.Attributes.AttributeSupportCollector.Collect(AssemblyDefinition assembly) at Unity.IL2CPP.Attributes.AttributeSupportCollector.Collect(MinimalContext context, AssemblyDefinition assembly) at Unity.IL2CPP.AssemblyConversion.PrimaryCollection.Steps.PerAssembly.AttributeSupportCollection.ProcessItem(GlobalPrimaryCollectionContext context, AssemblyDefinition item) at Unity.IL2CPP.AssemblyConversion.Steps.Base.ScheduledItemsStepFunc5.WorkerWrapper(WorkItemData3 workerData) at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler1.ContinueWithResultsWorkItem4.InvokeWorker(Object context, Int32 uniqueId) at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler1.BaseContinueWorkItem2.Invoke(Object context, Int32 uniqueId) at Unity.IL2CPP.Contexts.Scheduling.PhaseWorkScheduler1.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 :0)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at <fac3a832ec4249a49c4da1051848dde5>:0) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo, System.String generatedCppOutputDirectory) (at <fac3a832ec4249a49c4da1051848dde5>:0) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data, System.String outputDirectory, System.Boolean platformSupportsManagedDebugging) (at <fac3a832ec4249a49c4da1051848dde5>:0) UnityEditorInternal.IL2CPPBuilder.Run () (at <fac3a832ec4249a49c4da1051848dde5>:0) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String tempFolder, System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at :0)
UnityEditor.Android.PostProcessor.Tasks.RunIl2Cpp.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (UnityEditor.BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at <5cf84f2cc5134566935b135856517214>:0)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at <5cf84f2cc5134566935b135856517214>: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 :0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

This is a bug in the IL2CPP code which has been corrected, I believe.

I would recommend trying the latest version of Unity in the release cycle you are currently using. If that does not correct the issue, please submit a bug report. There may have been a case of this that we did not correct.

Im currently using version 2020.2.0f1, also tried it with earlier versions.
Do you think the 2021 version has it fixed? if not I will submit the bug right now!, thanks!

No, I don’t believe that this is fixed in 2021 versions. Please submit a bug report then, thanks!

Same here, so we can not build with IL2CPP in 2020.x?

In general. 2020.x is working. Something specific here is causing an issue, but I’m not sure what it is. Can you submit a bug report? We will investigate this issue.

@JoshPeterson Thanks for the prompt reply, will check again and report if needed.

Do you know if this was ever fixed. I’m having a very similar error in unity 2020.2.3f1 compiling for Switch.

1 Like

I don’t believe we have a bug report on this issue yet. If you can submit one, we would appreciate it!

I’m also seeing similar issues with 2020.2.3 building for iOS. It works alright without development and script debugging turned on, otherwise getting:

Exception: IL2CPP error for method ‘System.Void UnityEngine.Networking.NetworkSystem.CRCMessage::.ctor()’ in […]/Library/PackageCache/com.unity.multiplayer-hlapi@1.0.8/Runtime/Messages.cs:793
System.IndexOutOfRangeException: Index was outside the bounds of the array.

Not having any issues with 2019.4.20

Can you submit this project with a bug report? I’d love to understand why this happens, especially because it appears to be a regression in behavior.

Not really having the time right now to look into this further, back to 2019.4. I’ve been using the ARCore Cloud Anchors sample and tried to build a development/script debugging build. I deleted Temp and Library so a clean project should trigger it.
You can try that and see if it already happens:

So I have tried a bit more stuff and submitted a bug report (Case 1318114). It seems to happen because of something in the ARCore Unity Extensions package. If I remove that the sample builds alright.
The location of the error is somewhere else every time, Unity packages, ARCore package, App code etc. but always the same IndexOutOfRangeException.

1 Like

Seeing this on 2020.3.0f1 with my UNET project that sends a custom struct to clients via TargetRPC. The same code compiles without issues on 2019.4.22f1.

We do have one bug report for this issue, but it looks like it does not have an associated project that causes the issue. IF you can submit a bug report that includes a project, that will help us track down the cause.

Are you talking about the Bug Report that I posted above? I added the info how to reproduce it quite a while ago but never got an answer. It still has not been accepted.

Yes, I was talking about that bug report. And sorry, I’ve read back in the notes more now, and I see your instructions. I’ll ping our QA team to get this moving then.

Hey Josh,

I was able to make a very small project that repros the bug, just a few scripts, just a bunch of Syncvars, synclists and NetworkMessages cause the problem. I’m not exactly sure how many, or which combination of them cause the problem.

It fails in the il2cpp on Windows, it also would fail on Switch Compilation.

A variant of this code work in unity 2017 in a fully shipped game on Nintendo Switch in il2cpp, so not sure what would have caused it to break.

Bug case 1328966, I attached the project to it.

My best guess is that UnetWeaver is generating duplicate named methods and functions, which il2cpp doesn’t work with.

Thanks for the bug report. I suspect you are correct about the cause, but we will investigate to be sure.

This has been fixed by version 1.1.1 of UNET released recently.