diff --git a/src/PerfView.TestUtilities/DebugAssertionTests.cs b/src/PerfView.TestUtilities/DebugAssertionTests.cs
index c561d9f4b..710abc8e7 100644
--- a/src/PerfView.TestUtilities/DebugAssertionTests.cs
+++ b/src/PerfView.TestUtilities/DebugAssertionTests.cs
@@ -11,6 +11,9 @@
///
/// This file can be linked into any project which needs to validate that assertions are behaving correctly
/// for the purpose of unit testing.
+ /// On .NET Framework, assertion failures throw via registered in
+ /// app.config. On .NET 5+, the DefaultTraceListener already throws on assertion failures, so no
+ /// additional listener configuration is needed.
///
public class DebugAssertionTests
{
diff --git a/src/PerfView.TestUtilities/ThrowingTraceListener.cs b/src/PerfView.TestUtilities/ThrowingTraceListener.cs
index b57b69fed..52eb976ee 100644
--- a/src/PerfView.TestUtilities/ThrowingTraceListener.cs
+++ b/src/PerfView.TestUtilities/ThrowingTraceListener.cs
@@ -5,7 +5,10 @@
namespace PerfView.TestUtilities
{
- // To enable this for a process, add the following to the app.config for the project:
+ // This listener converts Debug.Assert/Trace.Assert failures into xUnit test failures
+ // by throwing from the Fail() method.
+ //
+ // On .NET Framework (net462), this must be registered via app.config :
//
//
//
@@ -17,6 +20,13 @@ namespace PerfView.TestUtilities
//
//
//
+ //
+ // On .NET 5+, the app.config section is NOT
+ // processed, so this listener is never registered. However, the DefaultTraceListener
+ // on .NET 5+ already throws on assert failures, so no additional configuration is
+ // needed — Debug.Assert and Trace.Assert will throw without this listener.
+ // Should this behavior change, the ThrowingTraceListener tests will fail, which will tell us we
+ // need to do something to re-enable this listener.
public sealed class ThrowingTraceListener : TraceListener
{
public override void Fail(string message, string detailMessage)
diff --git a/src/TraceEvent/DynamicTraceEventParser.cs b/src/TraceEvent/DynamicTraceEventParser.cs
index 34a60e7a7..7415c4637 100644
--- a/src/TraceEvent/DynamicTraceEventParser.cs
+++ b/src/TraceEvent/DynamicTraceEventParser.cs
@@ -279,8 +279,16 @@ protected internal override void EnumerateTemplates(Func 0)
- {
- Trace.Listeners.AddRange(debugListenersCopy);
- }
}
}
diff --git a/src/TraceEvent/TraceEvent.cs b/src/TraceEvent/TraceEvent.cs
index e6045231b..921f3747c 100644
--- a/src/TraceEvent/TraceEvent.cs
+++ b/src/TraceEvent/TraceEvent.cs
@@ -2882,7 +2882,12 @@ protected TraceEventParser(TraceEventSource source, bool dontRegister = false)
}
#if DEBUG
- if (GetProviderName() != null && !m_ConfirmedAllEventsAreInEnumeration && !(this is PredefinedDynamicTraceEventParser))
+ // ApplicationServerTraceEventParser is auto-generated and has many events sharing the same
+ // task name, producing duplicate computed event names that ConfirmAllEventsAreInEnumeration
+ // cannot handle.
+ if (GetProviderName() != null && !m_ConfirmedAllEventsAreInEnumeration &&
+ !(this is PredefinedDynamicTraceEventParser) &&
+ !(this is Parsers.ApplicationServerTraceEventParser))
{
ConfirmAllEventsAreInEnumeration();
m_ConfirmedAllEventsAreInEnumeration = true;