提交 5785040e 编写于 作者: C CyrusNajmabadi

Make async method actually async. Be resilient to not finding a symbol.

上级 78ed0b34
......@@ -501,7 +501,12 @@ protected override bool TryExec(Guid commandGroup, uint commandId)
var project = this.Workspace.CurrentSolution.GetProject(symbolListItem.ProjectId);
if (project != null)
{
FindReferences(streamingPresenter, symbolListItem, project);
// Note: we kick of FindReferencesAsync in a 'fire and forget' manner.
// We don't want to block the UI thread while we compute the references,
// and the references will be asynchronously added to the FindReferences
// window as they are computed. The user also knows something is happening
// as the window, with the progress-banner will pop up immediately.
var task = FindReferencesAsync(streamingPresenter, symbolListItem, project);
return true;
}
}
......@@ -525,7 +530,7 @@ private IStreamingFindUsagesPresenter GetStreamingPresenter()
}
}
private async void FindReferences(
private async Task FindReferencesAsync(
IStreamingFindUsagesPresenter presenter, SymbolListItem symbolListItem, Project project)
{
try
......@@ -540,9 +545,11 @@ private IStreamingFindUsagesPresenter GetStreamingPresenter()
// Fire and forget the work to go get references.
var compilation = await project.GetCompilationAsync(cancellationToken).ConfigureAwait(false);
var symbol = symbolListItem.ResolveSymbol(compilation);
await AbstractFindUsagesService.FindSymbolReferencesAsync(
context, symbol, project, cancellationToken).ConfigureAwait(false);
if (symbol != null)
{
await AbstractFindUsagesService.FindSymbolReferencesAsync(
context, symbol, project, cancellationToken).ConfigureAwait(false);
}
// Note: we don't need to put this in a finally. The only time we might not hit
// this is if cancellation or another error gets thrown. In the former case,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册