Skip to content

Commit

Permalink
Remove eventlistener guard (#44896)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcpopMSFT authored Nov 19, 2024
2 parents 483e8ad + 64487c8 commit 8e18c80
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions test/HelixTasks/AssemblyScheduler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ public AssemblyPartitionInfo(string assemblyPath)

public sealed class AssemblyScheduler
{
/// <summary>
/// This is a test class inserted into assemblies to guard against a .NET desktop bug. The tests
/// inside of it counteract the underlying issue. If this test is included in any assembly it
/// must be added to every partition to ensure the work around is present
///
/// https://github.com/dotnet/corefx/issues/3793
/// https://github.com/dotnet/roslyn/issues/8936
/// </summary>
private const string EventListenerGuardFullName = "Microsoft.CodeAnalysis.UnitTests.EventListenerGuard";

private readonly struct TypeInfo
{
Expand Down Expand Up @@ -78,23 +69,20 @@ private sealed class AssemblyInfoBuilder
private readonly StringBuilder _builder = new();
private readonly string _assemblyPath;
private readonly int _methodLimit;
private readonly bool _hasEventListenerGuard;
private readonly bool _netFramework;
private int _currentId;
private List<TypeInfo> _currentTypeInfoList = new();

private AssemblyInfoBuilder(string assemblyPath, int methodLimit, bool hasEventListenerGuard, bool netFramework = false)
private AssemblyInfoBuilder(string assemblyPath, int methodLimit, bool netFramework = false)
{
_assemblyPath = assemblyPath;
_methodLimit = methodLimit;
_hasEventListenerGuard = hasEventListenerGuard;
_netFramework = netFramework;
}

internal static void Build(string assemblyPath, int methodLimit, List<TypeInfo> typeInfoList, out List<Partition> partitionList, out List<AssemblyPartitionInfo> assemblyInfoList, bool netFramework = false)
{
var hasEventListenerGuard = typeInfoList.Any(x => x.FullName == EventListenerGuardFullName);
var builder = new AssemblyInfoBuilder(assemblyPath, methodLimit, hasEventListenerGuard, netFramework);
var builder = new AssemblyInfoBuilder(assemblyPath, methodLimit, netFramework);
builder.Build(typeInfoList);
partitionList = builder._partitionList;
assemblyInfoList = builder._assemblyInfoList;
Expand Down Expand Up @@ -131,12 +119,6 @@ private void BeginPartition()
_currentId++;
_currentTypeInfoList = new List<TypeInfo>();
_builder.Length = 0;

// Ensure the EventListenerGuard is in every partition.
if (_hasEventListenerGuard)
{
_builder.Append($@"-class ""{EventListenerGuardFullName}"" ");
}
}

private void CheckForPartitionLimit(bool done)
Expand Down

0 comments on commit 8e18c80

Please sign in to comment.