Skip to content
This repository was archived by the owner on Oct 16, 2020. It is now read-only.

Commit 74ab0ec

Browse files
fix #267
1 parent 33c72ed commit 74ab0ec

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/AddIns/BackendBindings/CSharpBinding/Project/Src/Refactoring/CSharpCodeActionProviderDoozer.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using System.Linq;
88
using System.Threading;
99
using System.Threading.Tasks;
10+
using ICSharpCode.SharpDevelop;
1011
using CSharpBinding.Parser;
1112
using ICSharpCode.Core;
1213
using ICSharpCode.NRefactory.CSharp;
@@ -93,11 +94,17 @@ public Task<IContextAction[]> GetAvailableActionsAsync(EditorRefactoringContext
9394
int selectionLength = editor.SelectionLength;
9495
return Task.Run(
9596
async delegate {
96-
if (!CreateCodeActionProvider())
97+
try {
98+
if (!CreateCodeActionProvider())
99+
return new IContextAction[0];
100+
CSharpAstResolver resolver = await context.GetAstResolverAsync().ConfigureAwait(false);
101+
var refactoringContext = new SDRefactoringContext(context.TextSource, resolver, context.CaretLocation, selectionStart, selectionLength, cancellationToken);
102+
return codeActionProvider.GetActions(refactoringContext).Select(Wrap).ToArray();
103+
} catch (Exception ex) {
104+
SD.Log.WarnFormatted("CSharpContextActionProviderWrapper crashed: {0}", ex);
105+
SD.AnalyticsMonitor.TrackException(ex);
97106
return new IContextAction[0];
98-
CSharpAstResolver resolver = await context.GetAstResolverAsync().ConfigureAwait(false);
99-
var refactoringContext = new SDRefactoringContext(context.TextSource, resolver, context.CaretLocation, selectionStart, selectionLength, cancellationToken);
100-
return codeActionProvider.GetActions(refactoringContext).Select(Wrap).ToArray();
107+
}
101108
}, cancellationToken);
102109
}
103110

0 commit comments

Comments
 (0)