Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit c3d04c6

Browse files
committed
Fix EventSource tests.
1 parent a7fae64 commit c3d04c6

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/mscorlib/shared/System/Diagnostics/Tracing/EventSource.cs

100644100755
Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,7 @@ protected virtual void Dispose(bool disposing)
14221422
if (disposing)
14231423
{
14241424
#if FEATURE_MANAGED_ETW
1425+
#if !FEATURE_PERFTRACING
14251426
// Send the manifest one more time to ensure circular buffers have a chance to get to this information
14261427
// even in scenarios with a high volume of ETW events.
14271428
if (m_eventSourceEnabled)
@@ -1434,6 +1435,7 @@ protected virtual void Dispose(bool disposing)
14341435
{ } // If it fails, simply give up.
14351436
m_eventSourceEnabled = false;
14361437
}
1438+
#endif
14371439
if (m_provider != null)
14381440
{
14391441
m_provider.Dispose();
@@ -2295,7 +2297,7 @@ private unsafe void DispatchToAllListeners(int eventId, Guid* childActivityID, E
22952297
[SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "This does not need to be correct when racing with other threads")]
22962298
private unsafe void WriteEventString(EventLevel level, long keywords, string msgString)
22972299
{
2298-
#if FEATURE_MANAGED_ETW
2300+
#if FEATURE_MANAGED_ETW && !FEATURE_PERFTRACING
22992301
if (m_provider != null)
23002302
{
23012303
string eventName = "EventSourceMessage";
@@ -2331,7 +2333,7 @@ private unsafe void WriteEventString(EventLevel level, long keywords, string msg
23312333
data.Ptr = (ulong)msgStringPtr;
23322334
data.Size = (uint)(2 * (msgString.Length + 1));
23332335
data.Reserved = 0;
2334-
m_provider.WriteEvent(ref descr, m_eventData[0].EventHandle, null, null, 1, (IntPtr)((void*)&data));
2336+
m_provider.WriteEvent(ref descr, IntPtr.Zero, null, null, 1, (IntPtr)((void*)&data));
23352337
}
23362338
}
23372339
}
@@ -2779,11 +2781,13 @@ internal void DoCommand(EventCommandEventArgs commandArgs)
27792781
{
27802782
// eventSourceDispatcher == null means this is the ETW manifest
27812783

2784+
#if !FEATURE_PERFTRACING
27822785
// Note that we unconditionally send the manifest whenever we are enabled, even if
27832786
// we were already enabled. This is because there may be multiple sessions active
27842787
// and we can't know that all the sessions have seen the manifest.
27852788
if (!SelfDescribingEvents)
27862789
SendManifest(m_rawManifest);
2790+
#endif
27872791
}
27882792

27892793
#if FEATURE_ACTIVITYSAMPLING
@@ -2907,12 +2911,14 @@ internal void DoCommand(EventCommandEventArgs commandArgs)
29072911
}
29082912
else
29092913
{
2914+
#if !FEATURE_PERFTRACING
29102915
if (commandArgs.Command == EventCommand.SendManifest)
29112916
{
29122917
// TODO: should we generate the manifest here if we hadn't already?
29132918
if (m_rawManifest != null)
29142919
SendManifest(m_rawManifest);
29152920
}
2921+
#endif
29162922

29172923
// These are not used for non-update commands and thus should always be 'default' values
29182924
// Debug.Assert(enable == true);
@@ -3132,6 +3138,7 @@ private void EnsureDescriptorsInitialized()
31323138
{
31333139
// GetMetadata failed, so we have to set it via reflection.
31343140
Debug.Assert(m_rawManifest == null);
3141+
31353142
m_rawManifest = CreateManifestAndDescriptors(this.GetType(), Name, this);
31363143
Debug.Assert(m_eventData != null);
31373144

@@ -3168,7 +3175,7 @@ private void EnsureDescriptorsInitialized()
31683175
#if FEATURE_PERFTRACING
31693176
// Initialize the EventPipe event handles.
31703177
DefineEventPipeEvents();
3171-
#endif
3178+
#endif
31723179
}
31733180
if (s_currentPid == 0)
31743181
{
@@ -3701,11 +3708,7 @@ private static byte[] CreateManifestAndDescriptors(Type eventSourceType, string
37013708
throw new ArgumentException(msg, exception);
37023709
}
37033710

3704-
#if FEATURE_PERFTRACING
3705-
return null;
3706-
#else
37073711
return bNeedsManifest ? res : null;
3708-
#endif
37093712
}
37103713

37113714
private static bool RemoveFirstArgIfRelatedActivityId(ref ParameterInfo[] args)

0 commit comments

Comments
 (0)