未验证 提交 e3de7de3 编写于 作者: J Jason Malinowski 提交者: GitHub

Merge pull request #30675 from jasonmalinowski/fix-tryapplychanges-modifying-additional-files

Fix crash when applying code fixes that modify additional files
......@@ -85,7 +85,9 @@ protected override void OnDocumentClosing(DocumentId documentId)
public virtual string GetFilePath(DocumentId documentId)
{
return CurrentSolution.GetDocument(documentId)?.FilePath;
var solution = CurrentSolution;
return (solution.GetDocument(documentId) ?? solution.GetAdditionalDocument(documentId))?.FilePath;
}
/// <summary>
......
......@@ -267,7 +267,7 @@ internal IVisualStudioHostDocument GetHostDocument(DocumentId documentId)
}
// first make sure we can edit the document we will be updating (check them out from source control, etc)
var changedDocs = projectChanges.SelectMany(pd => pd.GetChangedDocuments(true)).ToList();
var changedDocs = projectChanges.SelectMany(pd => pd.GetChangedDocuments(true).Concat(pd.GetChangedAdditionalDocuments())).ToList();
if (changedDocs.Count > 0)
{
this.EnsureEditableDocuments(changedDocs);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册