You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem description:
We develop a static analyzer. We faced a problem when getting the compilation of the project. If the GetCompilationAsync method is called for an object of the Microsoft.CodeAnalysis.Project type for any of npgsql projects, an exception is thrown — "An element with the same key but a different value already exists". Key: '(DocumentId, #95f3409a-8ab7-0422-0bf3-4a9d52062636 - LoggerMessage.g.cs)'".
Stack:
at System.Collections.Immutable.ImmutableSortedDictionary'2.FillFromEmpty(IEnumerable'1 items, Boolean overwriteOnCollision) in //src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs:line 887
at System.Collections.Immutable.ImmutableSortedDictionary'2.AddRange(IEnumerable'1 items, Boolean overwriteOnCollision, Boolean avoidToSortedMap) in //src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs:line 824
at System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary[TSource,TKey,TValue](IEnumerable'1 source, Func'2 keySelector, Func'2 elementSelector, IComparer'1 keyComparer) in //src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary.cs:line 173
at Microsoft.CodeAnalysis.TextDocumentStates'1..ctor(IEnumerable'1 states) in //src/Workspaces/Core/Portable/Workspace/Solution/TextDocumentStates.cs:line 49
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__40.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 964
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__34.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 565
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__33.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 529
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__32.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 488
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__30.MoveNext() in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 411
Apparently, the problem is related to the auto-generation of files by the Microsoft.Extensions.Logging library (the LoggerMessage attribute).
We should point out that we use bindingRedirect from versions 0.0.0.0 - 4.4.0.0 to 4.4.0.0 for the following packages:
Microsoft.CodeAnalysis
Microsoft.CodeAnalysis.CSharp
Microsoft.CodeAnalysis.CSharp.Features
Microsoft.CodeAnalysis.CSharp.Workspaces
Microsoft.CodeAnalysis.Features
Microsoft.CodeAnalysis.VisualBasic
Microsoft.CodeAnalysis.VisualBasic.Features
Microsoft.CodeAnalysis.VisualBasic.Workspaces
Microsoft.CodeAnalysis.Workspaces
Microsoft.CodeAnalysis.Workspaces.MSBuild
And from version 0.0.0.0 - 1.0.0.0 to 1.0.0.0 for the Microsoft.CodeAnalysis.Elfie package.
We would appreciate it if you could help us solve this problem.
Expected Behavior:
Get the compilation.
Actual Behavior:
An exception is thrown.
The text was updated successfully, but these errors were encountered:
I see this is an older bug that only finally made it my way -- @NikiPn this could indicate the generator is being ran twice; we did merge #64729 which should have fixed this (or at least changed it to a more understandable problem.) If you haven't already moved to newer Roslyn packages, please do so.
I'm going to close this as "fixed" but if you're still seeing issues with latest bits please don't hesitate to reactivate!
Version Used:
4.4.0-3.22518.13
Problem description:
We develop a static analyzer. We faced a problem when getting the compilation of the project. If the GetCompilationAsync method is called for an object of the Microsoft.CodeAnalysis.Project type for any of npgsql projects, an exception is thrown — "An element with the same key but a different value already exists". Key: '(DocumentId, #95f3409a-8ab7-0422-0bf3-4a9d52062636 - LoggerMessage.g.cs)'".
Stack:
at System.Collections.Immutable.ImmutableSortedDictionary'2.FillFromEmpty(IEnumerable'1 items, Boolean overwriteOnCollision) in //src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs:line 887
at System.Collections.Immutable.ImmutableSortedDictionary'2.AddRange(IEnumerable'1 items, Boolean overwriteOnCollision, Boolean avoidToSortedMap) in //src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary_2.cs:line 824
at System.Collections.Immutable.ImmutableSortedDictionary.ToImmutableSortedDictionary[TSource,TKey,TValue](IEnumerable'1 source, Func'2 keySelector, Func'2 elementSelector, IComparer'1 keyComparer) in //src/libraries/System.Collections.Immutable/src/System/Collections/Immutable/ImmutableSortedDictionary.cs:line 173
at Microsoft.CodeAnalysis.TextDocumentStates'1..ctor(IEnumerable'1 states) in //src/Workspaces/Core/Portable/Workspace/Solution/TextDocumentStates.cs:line 49
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__40.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 964
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__34.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 565
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__33.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 529
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__32.MoveNext() in //src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 488
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__30.MoveNext() in /_/src/Workspaces/Core/Portable/Workspace/Solution/SolutionState.CompilationTracker.cs:line 411
Apparently, the problem is related to the auto-generation of files by the Microsoft.Extensions.Logging library (the LoggerMessage attribute).
We should point out that we use bindingRedirect from versions 0.0.0.0 - 4.4.0.0 to 4.4.0.0 for the following packages:
And from version 0.0.0.0 - 1.0.0.0 to 1.0.0.0 for the Microsoft.CodeAnalysis.Elfie package.
We would appreciate it if you could help us solve this problem.
Expected Behavior:
Get the compilation.
Actual Behavior:
An exception is thrown.
The text was updated successfully, but these errors were encountered: