Search Issue Tracker
Fixed in 2023.1.X
Fixed in 2020.3.X, 2021.3.X, 2022.1.X
[IL2CPP] Assembly.GetType returns a nested Class when the nested Class is defined before the non-nested one
1. Open the attached project "Case_1422119.zip" and load Scene "Assembly.GetType"
2. Ensure IL2CPP is selected as the Scripting Backend in Project Settings and "Development Build" is checked in Build Settings
3. Build and Run the Project
4. Observe the errors thrown in the Build
Expected result: The following errors are thrown:
"ClassA found in Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null: ClassA."
"ClassB not found in Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null."
Actual result: The following errors are thrown:
"ClassA found in Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null: ClassParent+ClassA."
"ClassB found in Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null: ClassParent+ClassB."
Reproducible with: 2020.2.0a18, 2020.3.35f1, 2021.3.3f1, 2022.1.1f1, 2022.2.0a14
Not reproducible with: 2019.4.39f1, 2020.1.17f1
Could not test with: 2020.2.0a1 - 2020.2.0a17 (Building the project fails)
- The project contains 2 definitions of ClassA: one is nested inside the ClassParent and one is defined outside of it. ClassB is nested inside ClassParent as well
- The ClassA found by GetType is the one that is defined first (in this case, ClassParent is defined before ClassA, thus the ClassA nested inside ClassParent is the one that is found)
- Not reproducible in Editor, Mono Builds, and C# Console Application
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
- Unity freezes when opening a project
- [Silicon] Artifacts appear in the Game view when resizing the window/entering the Play Mode in a specific project
- Marker in the animation’s preview window doesn’t stop when reaching the end of the timeline and jumps to the start of the animation when moving it with the cursor
- Animation Event marker is not placed on the current time of the timeline when using the “Add Event” button
- Editor crashes on vector_map<ConstantString,AssetBundle when using the LoadAssetAsync function