Skip to content

Error loading building attribute array item of type Type. #89

@WNP78

Description

@WNP78

Testing Cpp2IL on an empty URP project, in Unity 2021.2.16 (metadata v29)
Cpp2IL log file:

[23:15:20.554] ===Cpp2IL by Samboy063===
[23:15:20.555] A Tool to Reverse Unity's "il2cpp" Build Process.
[23:15:20.556] Version 2022.1.0-pre-release.3
[23:15:20.556] 
[23:15:20.557] [Warn] [Program] NO_COLOR set, disabling ANSI color codes as you requested.
[23:15:20.557] [Info] [Program] Running on Win32NT
[23:15:20.631] [Info] [Plugins] Using Plugin: Cpp2IL Built-In
[23:15:20.636] [Info] [Program] Determined game's unity version to be 2021.2.6
[23:15:20.658] [Info] [Library] Initializing Metadata...
[23:15:20.660] [Info] [Library] 	Using actual IL2CPP Metadata version 29
[23:15:20.844] [Info] [Library] Initialized Metadata in 186ms
[23:15:20.845] [Info] [Library] Using binary type Portable Executable (from LibCpp2IL)
[23:15:20.845] [Info] [Library] Searching Binary for Required Data...
[23:15:21.832] [Info] [Library] Got Binary codereg: 0x180D58B10, metareg: 0x180EEC1E0 in 987ms.
[23:15:21.833] [Info] [Library] Initializing Binary...
[23:15:21.915] [Info] [Library] Initialized Binary in 83ms
[23:15:21.944] [Info] [Library] Mapping pointers to Il2CppMethodDefinitions...Processed 40814 OK (30ms)
[23:15:22.079] [Info] [Program] Creating application model...Done.
[23:15:22.081] [Info] [Program] Running processor Attribute Injector...
[23:15:22.258] [Info] [Program] Processor Attribute Injector finished in 179.0241ms
[23:15:22.259] [Info] [Program] Outputting as Stub ("Dummy") DLL Files to C:\Users\wnp\Home\OtherProjects\Bonetech\Bonetech-Testing\Build\MelonLoader\Dependencies\Il2CppAssemblyGenerator\Cpp2IL\cpp2il_out...
[23:15:22.571] [ERROR] 
[23:15:22.578] [ERROR] Unhandled Exception: System.AggregateException: One or more errors occurred. ---> System.ArgumentException: Type is not a primitive
[23:15:22.579] [ERROR] Parameter name: type
[23:15:22.581] [ERROR]    at Cpp2IL.Core.Utils.AsmResolverUtils.GetPrimitiveTypeDef(Il2CppTypeEnum type) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\AsmResolverUtils.cs:line 45
[23:15:22.582] [ERROR]    at Cpp2IL.Core.Utils.AsmResolverAssemblyPopulator.GetTypeSigFromAttributeArg(AssemblyDefinition parentAssembly, BaseCustomAttributeParameter parameter) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\AsmResolverAssemblyPopulator.cs:line 84
[23:15:22.584] [ERROR]    at Cpp2IL.Core.Utils.AsmResolverAssemblyPopulator.BuildArrayArgument(AssemblyDefinition parentAssembly, CustomAttributeArrayParameter arrayParameter) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\AsmResolverAssemblyPopulator.cs:line 95
[23:15:22.585] [ERROR]    at Cpp2IL.Core.Utils.AsmResolverAssemblyPopulator.FromAnalyzedAttributeArgument(AssemblyDefinition parentAssembly, BaseCustomAttributeParameter parameter) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\AsmResolverAssemblyPopulator.cs:line 111
[23:15:22.586] [ERROR]    at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
[23:15:22.586] [ERROR]    at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
[23:15:22.587] [ERROR]    at AsmResolver.DotNet.Signatures.CustomAttributeSignature..ctor(IEnumerable`1 fixedArguments, IEnumerable`1 namedArguments)
[23:15:22.589] [ERROR]    at Cpp2IL.Core.Utils.AsmResolverAssemblyPopulator.CopyCustomAttributes(HasCustomAttributes source, IList`1 destination) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\AsmResolverAssemblyPopulator.cs:line 139
[23:15:22.590] [ERROR]    at Cpp2IL.Core.Utils.AsmResolverAssemblyPopulator.PopulateCustomAttributes(AssemblyAnalysisContext asmContext) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\AsmResolverAssemblyPopulator.cs:line 171
[23:15:22.591] [ERROR]    at Cpp2IL.Core.Utils.MiscUtils.<>c__DisplayClass13_0`1.<ExecuteParallel>b__0(T t) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\Utils\MiscUtils.cs:line 262
[23:15:22.592] [ERROR]    at System.Linq.Parallel.PartitionedDataSource`1.ListContiguousIndexRangeEnumerator.MoveNext(T& currentElement, Int32& currentKey)
[23:15:22.593] [ERROR]    at System.Linq.Parallel.StopAndGoSpoolingTask`2.SpoolingWork()
[23:15:22.594] [ERROR]    at System.Linq.Parallel.SpoolingTaskBase.Work()
[23:15:22.594] [ERROR]    at System.Linq.Parallel.QueryTask.BaseWork(Object unused)
[23:15:22.595] [ERROR]    at System.Threading.Tasks.Task.Execute()
[23:15:22.596] [ERROR]    --- End of inner exception stack trace ---
[23:15:22.597] [ERROR]    at System.Linq.Parallel.QueryTaskGroupState.QueryEnd(Boolean userInitiatedDispose)
[23:15:22.599] [ERROR]    at System.Linq.Parallel.MergeExecutor`1.Execute[TKey](PartitionedStream`2 partitions, Boolean ignoreOutput, ParallelMergeOptions options, TaskScheduler taskScheduler, Boolean isOrdered, CancellationState cancellationState, Int32 queryId)
[23:15:22.600] [ERROR]    at System.Linq.Parallel.PartitionedStreamMerger`1.Receive[TKey](PartitionedStream`2 partitionedStream)
[23:15:22.601] [ERROR]    at System.Linq.Parallel.UnaryQueryOperator`2.UnaryQueryOperatorResults.GivePartitionedStream(IPartitionedStreamRecipient`1 recipient)
[23:15:22.603] [ERROR]    at System.Linq.Parallel.QueryOperator`1.GetOpenedEnumerator(Nullable`1 mergeOptions, Boolean suppressOrder, Boolean forEffect, QuerySettings querySettings)
[23:15:22.604] [ERROR]    at System.Linq.Parallel.QueryOpeningEnumerator`1.OpenQuery()
[23:15:22.604] [ERROR]    at System.Linq.Parallel.QueryOpeningEnumerator`1.MoveNext()
[23:15:22.605] [ERROR]    at System.Linq.ParallelEnumerable.ToList[TSource](ParallelQuery`1 source)
[23:15:22.606] [ERROR]    at Cpp2IL.Core.CorePlugin.AsmResolverDummyDllOutputFormat.DoOutput(ApplicationAnalysisContext context, String outputRoot) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL.Core\CorePlugin\AsmResolverDummyDllOutputFormat.cs:line 48
[23:15:22.607] [ERROR]    at Cpp2IL.Program.MainWithArgs(Cpp2IlRuntimeArgs runtimeArgs) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL\Program.cs:line 340
[23:15:22.609] [ERROR]    at Cpp2IL.Program.Main(String[] args) in C:\Users\Sam\RiderProjects\Cpp2IL\Cpp2IL\Program.cs:line 268

I added some debug logs to AsmResolverAssemblyPopulator.BuildArrayArgument check what the attribute values offending were:
parentAssembly: Unity.RenderPipelines.Universal.Runtime, Version=0.0.0.0, PublicKeyToken=null
arrayParameter: (IL2CPP_TYPE_IL2CPP_TYPE_INDEX) [typeof(UniversalRenderPipeline)]

So if I had to guess it would be it's tripping over when there's an attribute with an array of Types, entered as typeof( expressions.

I can provide the sample project files if you need it, but it is just an empty URP project.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions