Search Issue Tracker

Fixed in 2021.2.X

Fixed in 2020.3.X, 2021.1.X

Votes

2

Found in

2018.4

2020.1.0a22

2020.2.7f1

2020.3

2021.1

2021.2

Issue ID

1320295

Regression

Yes

[IL2CPP] ExecutionEngineException error is being spammed in Build when calling Linq.ParallelEnumerable.ForAll

IL2CPP

-

Reproduction steps:
1. Open the attached "case_1320295.zip" project
2. Open the Build Settings and check the Development Build option
3. Build and Run the project

Expected result: no errors are thrown in the Standalone console window
Actual result: the following error is constantly spammed: ExecutionEngineException: Attempting to call method 'System.Linq.Parallel.ForAllOperator` <...>' for which no ahead of time (AOT) code was generated.

Reproducible with: 2018.4.32f1, 2019.3.0a10, 2020.1.0a22, 2020.3.2f1, 2021.1.0f1, 2021.2.0a10
Not reproducible with: 2019.3.0a11, 2019.4.23f1, 2020.1.0a21

Notes:
- it seems the issue was fixed in 2019.3.0a11 and then regressed in 2020.1.0a22
- the issue does not occur with Mono Scripting Backend

Full error message:
ExecutionEngineException: Attempting to call method 'System.Linq.Parallel.ForAllOperator`1<UnityTemplateProjects.SimpleCameraController+TestClass>::WrapPartitionedStream<System.Int32>' for which no ahead of time (AOT) code was generated.
at System.Linq.Parallel.UnaryQueryOperator`2+UnaryQueryOperatorResults+ChildResultsRecipient[TInput,TOutput].Receive[TKey] (System.Linq.Parallel.PartitionedStream`2[TElement,TKey] inputStream) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.ScanQueryOperator`1+ScanEnumerableQueryOperatorResults[TElement].GivePartitionedStream (System.Linq.Parallel.IPartitionedStreamRecipient`1[TElement] recipient) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.UnaryQueryOperator`2+UnaryQueryOperatorResults[TInput,TOutput].GivePartitionedStream (System.Linq.Parallel.IPartitionedStreamRecipient`1[TElement] recipient) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.QueryOperator`1[TOutput].GetOpenedEnumerator (System.Nullable`1[T] mergeOptions, System.Boolean suppressOrder, System.Boolean forEffect, System.Linq.Parallel.QuerySettings querySettings) [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.Parallel.ForAllOperator`1[TInput].RunSynchronously () [0x00000] in <00000000000000000000000000000000>:0
at System.Linq.ParallelEnumerable.ForAll[TSource] (System.Linq.ParallelQuery`1[TSource] source, System.Action`1[T] action) [0x00000] in <00000000000000000000000000000000>:0
at UnityTemplateProjects.SimpleCameraController.Update () [0x00000] in <00000000000000000000000000000000>:0

  1. Resolution Note (fix version 2021.2):

    In 2021.1 and 2021.2 the fix causes a performance and size regression. Therefore, in 2021.2.0a17 and above a new command-line argument, --generic-virtual-method-iterations , was added to allow working around the issue.

    You can either run the Unity editor with an environment variable set: IL2CPP_ADDITIONAL_ARGS or you can use an Editor script to call PlayerSettings.SetAdditionalIl2CppArgs("--generic-virtual-method-iterations=2").

  2. Resolution Note (fix version 2021.1):

    Fixed in: 2021.1.10f1

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.