Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

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

Discussion in 'Entity Component System' started by slims, Jan 25, 2023.

  1. slims

    slims

    Joined:
    Dec 31, 2013
    Posts:
    86
    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:

    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](SyntaxList`1 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](SyntaxList`1 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, IReadOnlyList`1 systemDescriptions) |--| at Unity.Entities.SourceGen.SystemGeneratorCommon.PartialSystemTypeGenerator.Generate(SystemDescription[] allDescriptionsForTheSameSystem) |--| at Unity.Entities.SourceGen.SystemGenerator.SystemGenerator.<>c__DisplayClass2_1.<Execute>b__2(KeyValuePair`2 kvp) |--| at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) |--| --- End of stack trace from previous location --- |--| at System.Threading.Tasks.Parallel.<>c__DisplayClass44_0`2.<PartitionerForEachWorker>b__1(IEnumerator& partitionState, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion) |--| at System.Threading.Tasks.TaskReplicator.Replica`1.ExecuteAction(Boolean& yieldedBeforeCompletion) |--| at System.Threading.Tasks.TaskReplicator.Replica.Execute() |--| --- End of inner exception stack trace --- |--| at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure) |--| at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 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](Partitioner`1 source, ParallelOptions parallelOptions, Action`1 simpleBody, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) |--| at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) |--| at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 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?
     
  2. slims

    slims

    Joined:
    Dec 31, 2013
    Posts:
    86
    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
    Code (CSharp):
    1.       var job = new BlueprintInstantiatorJob();
    2.       job.PlacementOrigin = GridHelper.SnapToGrid(UnitSelector.Instance.BuildingPlaneHitInfo.point);
    3.       job.PlaceableConfig = FFConfig.Instance.PlaceableConfigLookup;
    4.       job.Run();
    5.  
    Which got altered after I upgraded to this (notice the last line):

    Code (CSharp):
    1.       var job = new BlueprintInstantiatorJob();
    2.       job.PlacementOrigin = GridHelper.SnapToGrid(UnitSelector.Instance.BuildingPlaneHitInfo.point);
    3.       job.PlaceableConfig = FFConfig.Instance.PlaceableConfigLookup;
    4.       IJobEntityExtensions.Run(job);
    5.  
    When I put it back to job.Run(), it worked fine. Still a mystery to me why it got changed in this way.
     
    Niter88, apkdev and jivalenzuela like this.