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.
- AudioManager.Update takes up significantly more CPU time when a big number of Audio Sources are stopped at one time
- [Linux] Editor doesn't build a project when "Install into source code 'build' folder" is enabled after switching projects
- [OpenXR][Vulkan][URP] MSAA does not work on Quest 1/2 builds when using URP + OpenXR + Vulkan
- UI Builder lacks visual feedback on reordering elements when Unity Editor is set to Light Theme
- Crash on core::StringStorageDefault<char>::assign when opening a project