Skip to content

Cyclic project references can hang the IDE #39904

@sharwell

Description

@sharwell

Version Used: 16.4 Preview 4

Steps to Reproduce:

  1. Create a project with a <ProjectReference> to itself. This can also occur if the project contains a <Reference> to an assembly with the same name as the project, since the project system can implicitly convert this to a <ProjectReference> for use in the IDE.
  2. Edit the project and attempt to use code fixes.

Expected Behavior:

An error is reported in the error list for the cyclic reference.

Actual Behavior:

The IDE hangs.

!dumpasync shows an asynchronous stack that attempts to recursively obtain a semaphore, and thus cannot make progress:

3083e57c <0> System.Threading.SemaphoreSlim+<WaitUntilCountOrTimeoutAsync>d__31 @ 72650098
..3083e644 <0> Roslyn.Utilities.SemaphoreSlimExtensions+<DisposableWaitAsync>d__1 @ 1213f390
..3083e700 <0> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<GetOrBuildCompilationInfoAsync>d__22 @ 12157df0
..3083e7cc <0> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<GetCompilationSlowAsync>d__19 @ 12157cb0
..3083e880 <0> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<GetMetadataReferenceAsync>d__32 @ 12159420
..3083e948 <1> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<FinalizeCompilationAsync>d__30 @ 12158e60
..3083ea20 <1> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<BuildFinalStateFromInProgressStateAsync>d__27 @ 12187610
..3083eae8 <1> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<GetOrBuildCompilationInfoAsync>d__22 @ 12157df0
..3083ebb4 <0> Microsoft.CodeAnalysis.SolutionState+CompilationTracker+<GetCompilationSlowAsync>d__19 @ 12157cb0
..3083ec68 <1> Microsoft.CodeAnalysis.Document+<GetSemanticModelAsync>d__23 @ 1215f720

Metadata

Metadata

Labels

Area-IDEBugIDE-ProjectProject system and MSBuild interactionsTenet-ReliabilityCustomer telemetry indicates that the product is failing in a crash/hang/dataloss manner.help wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions