提交 cb124f6b 编写于 作者: S Sam Harwell

Install a TraceListener for integration testing

Fixes #33599
上级 f32205e5
......@@ -84,6 +84,8 @@ private void StartServiceCallback(object sender, EventArgs e)
{
if (_startMenuCmd.Enabled)
{
IntegrationTestTraceListener.Install();
_service = new IntegrationService();
_serviceChannel = new IpcServerChannel(
......
......@@ -20,6 +20,7 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke
{
await base.InitializeAsync(cancellationToken, progress).ConfigureAwait(true);
await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken);
cancellationToken.ThrowIfCancellationRequested();
IntegrationTestServiceCommands.Initialize(this);
}
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Diagnostics;
using Microsoft.CodeAnalysis.ErrorReporting;
namespace Microsoft.VisualStudio.IntegrationTest.Setup
{
internal class IntegrationTestTraceListener : TraceListener
{
public override void Write(string message)
{
Exit(message);
}
public override void WriteLine(string message)
{
Exit(message);
}
private static void Exit(string message)
{
FatalError.Report(new Exception(message));
}
internal static void Install()
{
Trace.Listeners.Clear();
Trace.Listeners.Add(new IntegrationTestTraceListener());
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册