#[BUG] [IN-95963] Source generator issue with Entities 1.3.10

1 messages · Page 1 of 1 (latest)

vivid jolt
#

Trivial system that consists of two source files leads to the:

Assets\TestSystem.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.JobEntityGenerator.JobEntityGenerator.Execute(SourceProductionContext context, Compilation compilation, StructDeclarationSyntax candidate, Boolean checkUserDefinedQueriesForSchedulingJobs)'.

All previous Entities versions work fine.

Looks like the problem is with negated preprocessor symbol check block. Moving it below other using directives fixes the issue.

#if !TEST_SYMBOL
using UnityEngine;
#endif
fast osprey
#

Probably an error when they try to process directives in the method TypeCreationHelpers.GenerateSourceTextForRootNodes.

#

As suggested by the Roslyn community we should ignore directives entirely in the user code. Because SG only runs for 1 compilation context: with or without the directives.

vivid jolt
#

In Rukhanka, with roughly same situation, I have mismatched #if #endif pairs (redundant #endif without #if)

fast osprey
#

So I've removed all directive processing code in my SGs.

#

(which are based on Entities SG)

fast osprey
#

Turn out I'd been just overthinking about it.

proven lotus
#

@abstract pecan ^