Getting error SGICE002: This error indicates a bug in the DOTS source generators

I’m now upgrading from Entities 1.0 exp to pre.15. in this process, I’m also upgrading to use the new LocalTransform component. I’ve been working in safe mode for the last couple days just combing through and updating all my translation/rotation usages. After finishing that, I’m getting this error:

error SGICE002: This error indicates a bug in the DOTS source generators Assets\Scripts\UI\World\ScrollingText.cs(10,3): 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.AggregateException: One or more errors occurred. (Syntax node is not within syntax tree) |–| —> System.ArgumentException: Syntax node is not within syntax tree |–| at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.CheckSyntaxNode(CSharpSyntaxNode syntax) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSemanticModel.GetSymbolInfo(ExpressionSyntax expression, CancellationToken cancellationToken) |–| at Microsoft.CodeAnalysis.CSharp.CSharpExtensions.GetSymbolInfo(SemanticModel semanticModel, ExpressionSyntax expression, CancellationToken cancellationToken) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.KnownJobEntityInfo.GetIJobEntityTypeDeclarationAndArgument(MemberAccessExpressionSyntax schedulingNode, SemanticModel semanticModel, TypeInfo typeInfo, Boolean isExtensionMethodUsed) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.KnownJobEntityInfo.GetAndAddScheduleExpression(SystemDescription& systemDescription, Int32 i, MemberAccessExpressionSyntax currentSchedulingNode) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.Visit(SyntaxNode syntaxNode) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitInvocationExpression(InvocationExpressionSyntax node) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit(SyntaxNode node) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.Visit(SyntaxNode syntaxNode) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitExpressionStatement(ExpressionStatementSyntax node) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit(SyntaxNode node) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.Visit(SyntaxNode syntaxNode) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode](TNode node) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode](SyntaxList1 list) |--| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitBlock(BlockSyntax node) |--| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit(SyntaxNode node) |--| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.Visit(SyntaxNode syntaxNode) |--| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitMethodDeclaration(MethodDeclarationSyntax node) |--| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit(SyntaxNode node) |--| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.Visit(SyntaxNode syntaxNode) |--| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitListElement[TNode](TNode node) |--| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitList[TNode](SyntaxList1 list) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.VisitClassDeclaration(ClassDeclarationSyntax node) |–| at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxRewriter.Visit(SyntaxNode node) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.Visit(SyntaxNode syntaxNode) |–| at Unity.Entities.SourceGen.JobEntity.JobEntityModule.Rewriter.VisitTrackedSystem(SyntaxNode systemRootNode, String originalFilePath) |–| at Unity.Entities.SourceGen.SystemGeneratorCommon.PartialSystemTypeGenerator.ReplaceNodesInSystem(TypeDeclarationSyntax generatedPartialType, IReadOnlyList1 systemDescriptions) |--| at Unity.Entities.SourceGen.SystemGeneratorCommon.PartialSystemTypeGenerator.Generate(SystemDescription[ ] allDescriptionsForTheSameSystem) |--| at Unity.Entities.SourceGen.SystemGenerator.SystemGenerator.<>c__DisplayClass2_1.<Execute>b__2(KeyValuePair2 kvp) |–| at System.Threading.Tasks.Parallel.<>c__DisplayClass44_02.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) |--| --- End of stack trace from previous location --- |--| at System.Threading.Tasks.Parallel.<>c__DisplayClass44_02.b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) |–| at System.Threading.Tasks.TaskReplicator.Replica1.ExecuteAction(Boolean& yieldedBeforeCompletion) |--| at System.Threading.Tasks.TaskReplicator.Replica.Execute() |--| --- End of inner exception stack trace --- |--| at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction1 action, ParallelOptions options, Boolean stopOnFirstFailure) |–| at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner1 source, ParallelOptions parallelOptions, Action1 simpleBody, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) |–| — End of stack trace from previous location — |–| at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException) |–| at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner1 source, ParallelOptions parallelOptions, Action1 simpleBody, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) |–| at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable1 source, ParallelOptions parallelOptions, Action1 body, Action2 bodyWithState, Action3 bodyWithStateAndIndex, Func4 bodyWithStateAndLocal, Func5 bodyWithEverything, Func1 localInit, Action1 localFinally) |–| at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable1 source, ParallelOptions parallelOptions, Action1 body) |–| at Unity.Entities.SourceGen.SystemGenerator.SystemGenerator.Execute(GeneratorExecutionContext context)’

Although the error starts with Assets\Scripts\UI\World\ScrollingText.cs(10,3): error SGICE002, this is a red herring. ScrollingText is just a monobehaviour that does some UI stuff and does not interact with any ECS code at all. If I remove it, the error just points to another random file in the project.

So I’m not sure how to track down where this error is coming from; I have no compiler errors at this stage. Any ideas?

I solved this. After upgrading to Entities 1.0 pre-.15, somehow some code got altered (I’m assuming by some automatic process by Unity?).

I had this code

      var job = new BlueprintInstantiatorJob();
      job.PlacementOrigin = GridHelper.SnapToGrid(UnitSelector.Instance.BuildingPlaneHitInfo.point);
      job.PlaceableConfig = FFConfig.Instance.PlaceableConfigLookup;
      job.Run();

Which got altered after I upgraded to this (notice the last line):

      var job = new BlueprintInstantiatorJob();
      job.PlacementOrigin = GridHelper.SnapToGrid(UnitSelector.Instance.BuildingPlaneHitInfo.point);
      job.PlaceableConfig = FFConfig.Instance.PlaceableConfigLookup;
      IJobEntityExtensions.Run(job);

When I put it back to job.Run(), it worked fine. Still a mystery to me why it got changed in this way.

3 Likes