Skip to content

Commit

Permalink
Merge pull request #12060 from heejaechang/portfix11
Browse files Browse the repository at this point in the history
port of #12041 for microupdate
  • Loading branch information
jinujoseph authored Jun 21, 2016
2 parents 1b8e9fb + 947e008 commit 9511aeb
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,17 @@ private void RaiseProjectDiagnosticsCreated(Project project, StateSet stateSet,
foreach (var documentId in newAnalysisResult.DocumentIds)
{
var document = project.GetDocument(documentId);
Contract.ThrowIfNull(document);
if (document == null)
{
// it can happen with build synchronization since, in build case,
// we don't have actual snapshot (we have no idea what sources out of proc build has picked up)
// so we might be out of sync.
// example of such cases will be changing anything about solution while building is going on.
// it can be user explict actions such as unloading project, deleting a file, but also it can be
// something project system or roslyn workspace does such as populating workspace right after
// solution is loaded.
continue;
}

RaiseDocumentDiagnosticsIfNeeded(document, stateSet, AnalysisKind.NonLocal, oldAnalysisResult, newAnalysisResult, raiseEvents);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@ public void Reanalyze(Workspace workspace, IIncrementalAnalyzer analyzer, IEnume
var coordinator = default(WorkCoordinator);
if (!_documentWorkCoordinatorMap.TryGetValue(workspace, out coordinator))
{
throw new ArgumentException("workspace");
// this can happen if solution crawler is already unregistered from workspace.
// one of those example will be VS shutting down so roslyn package is disposed but there is a pending
// async operation.
return;
}

// no specific projects or documents provided
Expand Down

0 comments on commit 9511aeb

Please sign in to comment.