提交 c79306df 编写于 作者: N Nat Ayewah

Merge pull request #11459 from natidea/deadlock11019

Postpone AnalyzerChanged operations when analyzer is changed on file system
......@@ -619,10 +619,17 @@ private void OnImportChanged(object sender, EventArgs e)
private void OnAnalyzerChanged(object sender, EventArgs e)
{
VisualStudioAnalyzer analyzer = (VisualStudioAnalyzer)sender;
RemoveAnalyzerAssembly(analyzer.FullPath);
AddAnalyzerAssembly(analyzer.FullPath);
// Postpone handler's actions to prevent deadlock. This AnalyzeChanged event can
// be invoked while the FileChangeService lock is held, and VisualStudioAnalyzer's
// efforts to listen to file changes can lead to a deadlock situation.
// Postponing the VisualStudioAnalyzer operations gives this thread the opportunity
// to release the lock.
Dispatcher.CurrentDispatcher.BeginInvoke(new Action(() => {
VisualStudioAnalyzer analyzer = (VisualStudioAnalyzer)sender;
RemoveAnalyzerAssembly(analyzer.FullPath);
AddAnalyzerAssembly(analyzer.FullPath);
}));
}
// Internal for unit testing
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册