提交 77384e88 编写于 作者: C Cyrus Najmabadi

Don't crash when we hear about very stale diagnostics for our current Document.

上级 7b5bb3d6
......@@ -161,6 +161,30 @@ private void OnDiagnosticsUpdated(DiagnosticsUpdatedArgs e)
{
return;
}
// Make sure the editor we've got associated with these diagnostics is the
// same one we're a tagger for. It is possible for us to hear about diagnostics
// for the *same* Document that are not from the *same* buffer. For example,
// say we have the following chain of events:
//
// Document is opened.
// Diagnostics start analyzing.
// Document is closed.
// Document is opened.
// Diagnostics finish and report for document.
//
// We'll hear about diagnostics for the original Document/Buffer that was
// opened. But we'll be trying to apply them to this current Document/Buffer.
// That won't work since these will be different buffers (and thus, we won't
// be able to map the diagnostic spans appropriately).
//
// Note: returning here is safe. Because the file is closed/opened, The
// Diagnostics Service will reanalyze it. It will then report the new results
// which we will hear about and use.
if (editorSnapshot.TextBuffer != _subjectBuffer)
{
return;
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册