提交 55715e0a 编写于 作者: H HeeJae Chang

fixed crash found by testing

make sure commit from rename daskboard on closed razor file doesn't crash VS but show error message
上级 bf32f41a
......@@ -9,6 +9,7 @@
using System.Windows.Input;
using System.Windows.Media;
using Microsoft.CodeAnalysis.Editor.Implementation.InlineRename.HighlightTags;
using Microsoft.CodeAnalysis.Notification;
using Microsoft.VisualStudio.Text.Classification;
using Microsoft.VisualStudio.Text.Editor;
......@@ -316,8 +317,19 @@ private void Apply_Click(object sender, RoutedEventArgs e)
private void Commit()
{
_model.Session.Commit();
_textView.VisualElement.Focus();
try
{
_model.Session.Commit();
_textView.VisualElement.Focus();
}
catch(NotSupportedException ex)
{
// Session.Commit can throw if it can't commit
// rename operation.
// handle that case gracefully
var notificationService = _model.Session.Workspace.Services.GetService<INotificationService>();
notificationService.SendNotification(ex.Message, title: EditorFeaturesResources.Rename, severity: NotificationSeverity.Error);
}
}
public void Dispose()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册