Search Issue Tracker

Won't Fix



Found in [Package]


Issue ID




"DOTS source generators" error when using "#if" directives in imports

Package: Entity Component System (ECS)


Reproduction steps:
1. Open “MinProject“
2. Enter Safe Mode if prompted (otherwise opening gets stuck at Completing Domain)
3. Observe the Console

Expected result: no SGICE003 error
Actual result: an SGICE003 error

Reproduced in: 1.0.0-pre.47 (2022.2.10f1, 2023.1.0b7, 2023.2.0a5)
Could not test in: 0.51.1-preview.21 (2020.3.46f1, 2021.3.20f1) (Baker<> not supported)

Reproduced using: macOS 13.0.1 (Intel), Windows 11 (by the reporter)

Note: not reproduced when removing/commenting the first “#if UNITY_EDITOR” and “#endif“ directives

1. Assets/TestAuthoring.cs(1,1): error SGICE003: This error indicates a bug in the DOTS source generators. We'd appreciate a bug report (Help -> Report a Bug...). Thanks! Error message: 'System.ArgumentOutOfRangeException: Non-negative number required. (Parameter 'count') |--| at System.Text.StringBuilder.Insert(Int32 index, String value, Int32 count) |--| at Unity.Entities.SourceGen.Common.TypeCreationHelpers.GenerateSourceTextForRootNodes(String generatedSourceFilePath, BaseTypeDeclarationSyntax originalSyntax, String generatedSyntax, CancellationToken cancellationToken) |--| at Unity.Entities.SourceGen.JobEntity.JobEntityGenerator.Execute(SourceProductionContext context, Compilation compilation, StructDeclarationSyntax candidate, String projectPath, Boolean performSafetyChecks, Boolean outputSourceGenFiles)'.
2. Assets/TestAuthoring.cs(36,25): error CS0117: 'TestJob' does not contain a definition for 'InternalCompiler'
3. Assets/TestAuthoring.cs(39,50): error CS0315: The type 'TestJob' cannot be used as type parameter 'T' in the generic type or method 'JobChunkExtensions.ScheduleParallel<T>(T, EntityQuery, JobHandle)'. There is no boxing conversion from 'TestJob' to 'Unity.Entities.IJobChunk'.

  1. Resolution Note:

    There are no fixes planned for this Bug

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.