-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I believe it's the safer alternative to use Task.Wait
:
public CacheState ManageCache(ref ProviderCache cache, NormalizedSnapshotSpanCollection spans, ITextBuffer buffer)
{
if (cache != null && cache.Snapshot == spans[0].Snapshot)
{
return CacheState.Resolved;
}
ProviderCache cache1 = null;
var result = ThreadHelper.JoinableTaskFactory.Run<CacheState>(async () =>
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
try
{
cache1 = await ProviderCache.ResolveAsync(buffer, spans[0].Snapshot);
return cache1 == null ? CacheState.NotResolved : CacheState.Resolved;
}
catch (Exception ex)
{
Log.LogError(ex.ToString());
return CacheState.NotResolved;
}
});
cache = cache1;
return result;
}
Metadata
Metadata
Assignees
Labels
No labels