提交 c5e172e6 编写于 作者: D David Poeschl

Ensure Rename itemid handling is on UI thread

上级 6c2afcbc
......@@ -6,6 +6,7 @@
using System.Runtime.InteropServices;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.Editor;
using Microsoft.CodeAnalysis.Editor.Shared.Utilities;
using Microsoft.VisualStudio;
using Microsoft.VisualStudio.LanguageServices.Implementation.ProjectSystem;
using Microsoft.VisualStudio.LanguageServices.Implementation.RQName;
......@@ -15,10 +16,12 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation
{
[Export(typeof(IRefactorNotifyService))]
internal sealed class VsRefactorNotifyService : IRefactorNotifyService
internal sealed class VsRefactorNotifyService : ForegroundThreadAffinitizedObject, IRefactorNotifyService
{
public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, ISymbol symbol, string newName, bool throwOnFailure)
{
AssertIsForeground();
Dictionary<IVsHierarchy, List<uint>> hierarchyToItemIDsMap;
string[] rqnames;
......@@ -59,6 +62,8 @@ public bool TryOnBeforeGlobalSymbolRenamed(Workspace workspace, IEnumerable<Docu
public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable<DocumentId> changedDocumentIDs, ISymbol symbol, string newName, bool throwOnFailure)
{
AssertIsForeground();
Dictionary<IVsHierarchy, List<uint>> hierarchyToItemIDsMap;
string[] rqnames;
......@@ -103,6 +108,8 @@ public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable<Docum
out Dictionary<IVsHierarchy, List<uint>> hierarchyToItemIDsMap,
out string[] rqnames)
{
AssertIsForeground();
hierarchyToItemIDsMap = null;
rqnames = null;
......@@ -126,6 +133,8 @@ public bool TryOnAfterGlobalSymbolRenamed(Workspace workspace, IEnumerable<Docum
out Dictionary<IVsHierarchy, List<uint>> hierarchyToItemIDsMap,
out string rqname)
{
AssertIsForeground();
visualStudioWorkspace = null;
hierarchyToItemIDsMap = null;
rqname = null;
......@@ -169,6 +178,8 @@ private bool TryGetRenamingRQNameForSymbol(ISymbol symbol, out string rqname)
private Dictionary<IVsHierarchy, List<uint>> GetHierarchiesAndItemIDsFromDocumentIDs(VisualStudioWorkspaceImpl visualStudioWorkspace, IEnumerable<DocumentId> changedDocumentIDs)
{
AssertIsForeground();
var hierarchyToItemIDsMap = new Dictionary<IVsHierarchy, List<uint>>();
foreach (var docID in changedDocumentIDs)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册