maca88 / AsyncGenerator

Generating async c# code using Roslyn
MIT License
47 stars 16 forks source link

0.20.1 suddenly stopped working #163

Closed bahusoid closed 2 years ago

bahusoid commented 2 years ago

Not sure what happens but now it throws some random exceptions for 'NHibernate.Test' project. 0.18.3 still works fine for me. See https://github.com/nhibernate/nhibernate-core/pull/3014#issuecomment-1034535718 And another exception example:

     [exec]       Analyzing project 'NHibernate.Test' started
     [exec] info: AsyncGenerator.ProjectAnalyzer[0]
     [exec]       Parsing documents started
     [exec] info: AsyncGenerator.ProjectAnalyzer[0]
     [exec]       Parsing documents completed
     [exec] info: AsyncGenerator.ProjectAnalyzer[0]
     [exec]       Pre-analyzing documents started
     [exec] crit: AsyncGenerator.CommandLine[0]
     [exec]       One or more errors occurred. (symbol for field type ISessionFactory was not found)
     [exec]       System.AggregateException: One or more errors occurred. (symbol for field type ISessionFactory was not found)
     [exec]        ---> System.InvalidOperationException: symbol for field type ISessionFactory was not found
     [exec]          at AsyncGenerator.Internal.BaseFieldData..ctor(TypeData typeData, BaseFieldDeclarationSyntax node, SemanticModel semanticModel) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\Internal\FieldData.cs:line 20
     [exec]          at AsyncGenerator.Internal.TypeData.<>c__DisplayClass54_0.<GetBaseFieldData>b__0(BaseFieldDeclarationSyntax syntax) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\Internal\TypeData.cs:line 170
     [exec]          at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
     [exec]          at AsyncGenerator.Internal.TypeData.GetBaseFieldData(BaseFieldDeclarationSyntax node, SemanticModel semanticModel, Boolean create) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\Internal\TypeData.cs:line 170
     [exec]          at AsyncGenerator.Internal.DocumentData.GetNodeData(SyntaxNode node, Boolean create, NamespaceData namespaceData, TypeData typeData, BaseMethodData baseMethodData) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\Internal\DocumentData.cs:line 247
     [exec]          at AsyncGenerator.Analyzation.Internal.ProjectAnalyzer.PreAnalyzeDocumentData(DocumentData documentData) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\Analyzation\Internal\ProjectAnalyzer.PreAnalyze.cs:line 109
     [exec]          at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
     [exec]       --- End of stack trace from previous location ---
     [exec]          at System.Threading.Tasks.Parallel.<>c__DisplayClass19_0`1.<ForWorker>b__1(RangeWorker& currentWorker, Int32 timeout, Boolean& replicationDelegateYieldedBeforeCompletion)
     [exec]          at System.Threading.Tasks.TaskReplicator.Replica.Execute()
     [exec]          --- End of inner exception stack trace ---
     [exec]          at System.Threading.Tasks.TaskReplicator.Run[TState](ReplicatableUserAction`1 action, ParallelOptions options, Boolean stopOnFirstFailure)
     [exec]          at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
     [exec]       --- End of stack trace from previous location ---
     [exec]          at System.Threading.Tasks.Parallel.ThrowSingleCancellationExceptionOrOtherException(ICollection exceptions, CancellationToken cancelToken, Exception otherException)
     [exec]          at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally)
     [exec]          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)
     [exec]          at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body)
     [exec]          at AsyncGenerator.Analyzation.Internal.ProjectAnalyzer.Analyze(CancellationToken cancellationToken) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\Analyzation\Internal\ProjectAnalyzer.cs:line 81
     [exec]          at AsyncGenerator.AsyncCodeGenerator.GenerateProject(ProjectData projectData, ILoggerFactory loggerFactory, ILogger logger, CancellationToken cancellationToken) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\AsyncCodeGenerator.cs:line 152
     [exec]          at AsyncGenerator.AsyncCodeGenerator.GenerateAsync(AsyncCodeConfiguration configuration, CancellationToken cancellationToken) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator\AsyncCodeGenerator.cs:line 84
     [exec]          at AsyncGenerator.CommandLine.Program.Main(String[] args) in C:\Workspace\Git\AsyncGenerator\Source\AsyncGenerator.CommandLine\Program.cs:line 51

BUILD FAILED
maca88 commented 2 years ago

Unfortunately I am not able to reproduce this issue. Which version of dotnet are you using? You can try to remove the bin and obj folder for the NHibernate.Test project before running the generator, maybe it will help.

bahusoid commented 2 years ago

I tried removing bin but forgot about obj. Removing both obj and bin fixed it. Thanks!