Skip to content

Commit

Permalink
Merge pull request #47554 from sharwell/disallow-fail
Browse files Browse the repository at this point in the history
Initialize FatalError handlers in VS and OOP
  • Loading branch information
sharwell authored Sep 19, 2020
2 parents 6e4a781 + c560a93 commit ffa4e6d
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2502,7 +2502,7 @@ public class Goo
End Function

<WorkItem(544940, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544940")>
<WpfTheory, CombinatorialData>
<WpfTheory(Skip:="https://github.com/dotnet/roslyn/issues/47610"), CombinatorialData>
<Trait(Traits.Feature, Traits.Features.Completion)>
Public Async Function LocalFunctionAttributeNamedPropertyCompletionCommitWithTab(showCompletionInArgumentLists As Boolean) As Task
Using state = TestStateFactory.CreateCSharpTestState(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Collections.Generic;
using System.Threading;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.ErrorReporting;
using Microsoft.CodeAnalysis.FindSymbols;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Shared.Extensions;
Expand All @@ -24,6 +25,11 @@ public abstract class VisualStudioWorkspace : Workspace
private BackgroundCompiler? _backgroundCompiler;
private readonly BackgroundParser _backgroundParser;

static VisualStudioWorkspace()
{
WatsonReporter.InitializeFatalErrorHandlers();
}

internal VisualStudioWorkspace(HostServices hostServices)
: base(hostServices, WorkspaceKind.Host)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,11 @@ Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.Diagnostics
source.AddNewErrors(projectId1, GetDiagnosticData(projectId1))
Await waiter.ExpeditedWaitAsync()

Dim numberOfUpdateCalls = 0
AddHandler source.BuildProgressChanged, Sub(o, progress)
If progress = ExternalErrorDiagnosticUpdateSource.BuildProgress.Updated Then
Assert.Equal(1, source.GetBuildErrors().Length)
numberOfUpdateCalls += 1
Assert.Equal(numberOfUpdateCalls, source.GetBuildErrors().Length)
ElseIf progress = ExternalErrorDiagnosticUpdateSource.BuildProgress.Done Then
Assert.Equal(2, source.GetBuildErrors().Length)
End If
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,15 +401,13 @@ class { }
Public Sub AddCommandTarget(target As IOleCommandTarget, ByRef [next] As IOleCommandTarget) Implements IFindAllReferencesWindow.AddCommandTarget
Throw New NotImplementedException()
End Sub
#End Region

Public Sub SetProgress(progress As Double) Implements IFindAllReferencesWindow.SetProgress
Throw New NotImplementedException()
End Sub

Public Sub SetProgress(completed As Integer, maximum As Integer) Implements IFindAllReferencesWindow.SetProgress
Throw New NotImplementedException()
End Sub
#End Region
End Class

Private Class TableDataSink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ void M()
}";
VisualStudio.Editor.SetText(text);
VisualStudio.Editor.PlaceCaret("x");
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.ReferenceHighlighting);
VisualStudio.ExecuteCommand("Edit.NextHighlightedReference");
VisualStudio.Editor.InvokeNavigateToNextHighlightedReference();
VisualStudio.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.ReferenceHighlighting);
VisualStudio.Editor.Verify.CurrentLineText("x$$ = 3;", assertCaretPosition: true, trimWhitespace: true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ End Sub
End Class");

Verify("To", 4);
VisualStudio.ExecuteCommand("Edit.NextHighlightedReference");
VisualStudio.Editor.InvokeNavigateToNextHighlightedReference();
VisualStudio.Editor.Verify.CurrentLineText("For a = 0 To 1 Step$$ 1", assertCaretPosition: true, trimWhitespace: true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,12 @@ public ImmutableArray<TextSpan> GetTagSpans(string tagId)
return builder.ToImmutableAndFree();
}

public void InvokeNavigateToNextHighlightedReference()
{
_instance.Workspace.WaitForAsyncOperations(Helper.HangMitigatingTimeout, FeatureAttribute.ReferenceHighlighting);
_instance.ExecuteCommand(WellKnownCommandNames.Edit_NextHighlightedReference);
}

public string GetCurrentCompletionItem()
{
WaitForCompletionSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public static class WellKnownCommandNames
public const string Edit_LineEnd = "Edit.LineEnd";
public const string Edit_LineStartExtend = "Edit.LineStartExtend";
public const string Edit_LineEndExtend = "Edit.LineEndExtend";
public const string Edit_NextHighlightedReference = "Edit.NextHighlightedReference";
public const string Edit_SelectAll = "Edit.SelectAll";
public const string Edit_Copy = "Edit.Copy";
public const string Edit_Cut = "Edit.Cut";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<ItemGroup>
<Compile Include="..\..\..\VisualStudio\Core\Def\Implementation\Watson\WatsonExtensions.cs" Link="Services\WorkspaceTelemetry\WatsonExtensions.cs" />
<Compile Include="..\..\..\VisualStudio\Core\Def\Implementation\Watson\WatsonReporter.cs" Link="Services\WorkspaceTelemetry\WatsonReporter.cs" />
<Compile Include="..\..\..\VisualStudio\Core\Def\Implementation\Watson\WatsonTraceListener.cs" Link="Services\WorkspaceTelemetry\WatsonTraceListener.cs" />
<Compile Include="..\..\..\VisualStudio\Core\Def\Telemetry\VSTelemetryCache.cs" Link="Services\WorkspaceTelemetry\VSTelemetryCache.cs" />
<Compile Include="..\..\..\VisualStudio\Core\Def\Telemetry\VSTelemetryLogger.cs" Link="Services\WorkspaceTelemetry\VSTelemetryLogger.cs" />
<Compile Include="..\..\..\VisualStudio\Core\Def\Telemetry\AbstractWorkspaceTelemetryService.cs" Link="Services\WorkspaceTelemetry\AbstractWorkspaceTelemetryService.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ internal abstract partial class BrokeredServiceBase : IDisposable

static BrokeredServiceBase()
{
// Use a TraceListener hook to intercept assertion failures and report them through FatalError.
WatsonTraceListener.Install();
}

protected BrokeredServiceBase(in ServiceConstructionArguments arguments)
Expand Down
3 changes: 1 addition & 2 deletions src/Workspaces/Remote/ServiceHub/Services/ServiceBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ internal abstract class ServiceBase : IDisposable

static ServiceBase()
{
// Use a TraceListener hook to intercept assertion failures and report them through FatalError.
WatsonTraceListener.Install();
WatsonReporter.InitializeFatalErrorHandlers();
}

protected ServiceBase(IServiceProvider serviceProvider, Stream stream, IEnumerable<JsonConverter>? jsonConverters = null)
Expand Down

0 comments on commit ffa4e6d

Please sign in to comment.