Skip to content

Commit e3a102f

Browse files
authored
Use a ThrowingTraceListener in GenerateFilteredReferenceAssembliesTask (#83076)
1 parent ccea760 commit e3a102f

6 files changed

Lines changed: 11 additions & 66 deletions

File tree

src/Workspaces/Remote/ServiceHub/Host/ThrowingTraceListener.cs renamed to src/Compilers/Shared/ThrowingTraceListener.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
// Licensed to the .NET Foundation under one or more agreements.
1+
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

55
using System;
66
using System.Diagnostics;
77

8-
namespace Microsoft.CodeAnalysis.Remote;
8+
namespace Microsoft.CodeAnalysis;
99

1010
internal sealed class ThrowingTraceListener : TraceListener
1111
{

src/Compilers/Test/Core/Microsoft.CodeAnalysis.Test.Utilities.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
<Compile Include="..\..\..\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Extensions\ControlFlowRegionExtensions.cs" Link="Compilation\FlowAnalysis\ControlFlowRegionExtensions.cs" />
9191
<Compile Include="..\..\..\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\CustomDataFlowAnalysis.cs" Link="Compilation\FlowAnalysis\CustomDataFlowAnalysis.cs" />
9292
<Compile Include="..\..\..\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\FlowAnalysis\DataFlowAnalyzer.cs" Link="Compilation\FlowAnalysis\DataFlowAnalyzer.cs" />
93+
<Compile Include="..\..\..\Compilers\Shared\ThrowingTraceListener.cs" Link="ThrowingTraceListener.cs" />
9394
</ItemGroup>
9495
<ItemGroup>
9596
<EmbeddedResource Update="TestResource.resx" GenerateSource="true" />

src/Compilers/Test/Core/ThrowingTraceListener.cs

Lines changed: 0 additions & 63 deletions
This file was deleted.

src/Tools/SemanticSearch/BuildTask/GenerateFilteredReferenceAssembliesTask.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
using Microsoft.Build.Framework;
1919
using Microsoft.Build.Utilities;
2020
using Microsoft.CodeAnalysis.CSharp;
21-
using Roslyn.Utilities;
2221

2322
namespace Microsoft.CodeAnalysis.Tools;
2423

@@ -73,6 +72,10 @@ public sealed class GenerateFilteredReferenceAssembliesTask : Task
7372

7473
public override bool Execute()
7574
{
75+
// Ensure that debug assertion failures throw an exception instead of crashing the process
76+
Trace.Listeners.Clear();
77+
Trace.Listeners.Add(new ThrowingTraceListener());
78+
7679
#if !NET
7780
// https://github.com/dotnet/roslyn/issues/82006
7881
AppDomain.CurrentDomain.AssemblyResolve += (sender, args) =>

src/Tools/SemanticSearch/BuildTask/SemanticSearch.BuildTask.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<ProjectReference Include="..\..\..\Compilers\Core\Portable\Microsoft.CodeAnalysis.csproj" Private="true" />
1414
<ProjectReference Include="..\..\..\Compilers\CSharp\Portable\Microsoft.CodeAnalysis.CSharp.csproj" Private="true" />
1515
</ItemGroup>
16+
<ItemGroup>
17+
<Compile Include="..\..\..\Compilers\Shared\ThrowingTraceListener.cs" Link="ThrowingTraceListener.cs" />
18+
</ItemGroup>
1619
<ItemGroup>
1720
<InternalsVisibleTo Include="SemanticSearch.BuildTask.UnitTests" />
1821
</ItemGroup>

src/Workspaces/Remote/ServiceHub/Microsoft.CodeAnalysis.Remote.ServiceHub.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
<Compile Include="..\..\..\VisualStudio\Core\Def\Storage\FileDownloader.cs" Link="Host\Storage\FileDownloader.cs" />
3838
<Compile Include="..\..\..\VisualStudio\Core\Def\Telemetry\AbstractWorkspaceTelemetryService.cs" Link="Services\ProcessTelemetry\AbstractWorkspaceTelemetryService.cs" />
3939
<Compile Include="..\..\..\VisualStudio\Core\Def\Telemetry\Shared\*.cs" LinkBase="Services\ProcessTelemetry" />
40+
<Compile Include="..\..\..\Compilers\Shared\ThrowingTraceListener.cs" Link="Host\ThrowingTraceListener.cs" />
4041
</ItemGroup>
4142
<ItemGroup>
4243
<RestrictedInternalsVisibleTo Include="Microsoft.CodeAnalysis.LiveUnitTesting.BuildManager" Partner="UnitTesting" Key="$(UnitTestingKey)" />

0 commit comments

Comments
 (0)