Search Issue Tracker
Fixed
Fixed in 1.0.X - Entities
Votes
1
Found in [Package]
1.0.0
Issue ID
ECSB-362
Regression
No
'System.InvalidCastException' exception is thrown when using generics in SystemAPI.Query
How to reproduce:
1. Open the “Generic_Query_Bug” project
2. Open the “GenericQueryTest” script
3. Uncomment line 22 and save the script
4. Back in Editor observe the Console
Expected result: “GenericQueryTest” script compiles without any errors
Actual result: “GenericQueryTest” script throws “System.InvalidCastException” error
Reproduced with: 1.0.8 (2022.2.21f1, 2023.1.0b18, 2023.2.0a16)
Could not test with: 0.17.0-preview.41 (2022.2.21f1, 2023.1.0b18, 2023.2.0a16) (Package scripting errors), 0.17.0-preview.41 (2020.3.48f1, 2021.3.26f1), 1.0.8 (2020.3.48f1, 2021.3.26f1) (Package not supported)
Reproduced on: Windows 11
Full error log:
{noformat}Assets\GenericQueryTest.cs(18,1): error SGICE002: This error indicates a bug in the DOTS source generators. We'd appreciate a bug report (Help -> Report a Bug...). Thanks! Error message: 'System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Symbols.PublicModel.TypeParameterSymbol' to type 'Microsoft.CodeAnalysis.INamedTypeSymbol'. |--| at Unity.Entities.SourceGen.SystemGenerator.SystemAPI.Query.IdiomaticCSharpForEachDescription.<TryGetQueryDatas>g__TryGetIdiomaticCSharpForEachQueryType|73_0(ITypeSymbol typeSymbol, Location errorLocation) |--| at Unity.Entities.SourceGen.SystemGenerator.SystemAPI.Query.IdiomaticCSharpForEachDescription.TryGetQueryDatas(ICollection`1& queryTypes) |--| at Unity.Entities.SourceGen.SystemGenerator.SystemAPI.Query.IdiomaticCSharpForEachDescription..ctor(SystemDescription systemDescription, QueryCandidate queryCandidate, Int32 numForEachsPreviouslySeenInSystem) |--| at Unity.Entities.SourceGen.SystemGenerator.SystemAPI.Query.IdiomaticCSharpForEachModule.RegisterChangesInSystem(SystemDescription systemDescription) |--| at Unity.Entities.SourceGen.SystemGenerator.SystemGenerator.Execute(GeneratorExecutionContext context)'{noformat}
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Skinned Mesh Renderer with multiple Animator Components does not render when "Optimize Game Objects" is enabled
- [iOS]Certain characters are not displayed when using iOS devices with 18 OS and newer
- Trees do not render in 'Unity Terrain - URP Demo Scene'
- Silent crash when clicking in Scene View in a specific project
- The Player renders black on a Quest headset when MSAA, Post Processing, and Spacewarm depth submission are enabled
Add comment