-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Closed
Labels
area-System.Diagnostics.Tracingneeds-author-actionAn issue or pull request that requires more info or actions from the author.An issue or pull request that requires more info or actions from the author.runtime-monospecific to the Mono runtimespecific to the Mono runtime
Description
Description
I was testing integrating the Mono Runtime into my C++ application and encountered the following problem during the initialization phase:
at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage)
at System.Diagnostics.Debug.Fail(String message, String detailMessage)
at System.Diagnostics.Debug.Assert(Boolean condition, String message, String detailMessage)
at System.Diagnostics.Debug.Assert(Boolean condition, String message)
at System.Diagnostics.Debug.Assert(Boolean condition, AssertInterpolatedStringHandler& message)
at System.Diagnostics.Tracing.CounterGroup.OnEventSourceCommand(Object sender, EventCommandEventArgs e)
at System.Diagnostics.Tracing.EventSource.add_EventCommandExecuted(EventHandler`1 value)
at System.Diagnostics.Tracing.CounterGroup.RegisterCommandCallback()
at System.Diagnostics.Tracing.CounterGroup..ctor(EventSource eventSource)
at System.Diagnostics.Tracing.CounterGroup.GetCounterGroup(EventSource eventSource)
at System.Diagnostics.Tracing.DiagnosticCounter.Publish()
at System.Diagnostics.Tracing.PollingCounter..ctor(String name, EventSource eventSource, Func`1 metricProvider)
at System.Diagnostics.Tracing.RuntimeEventSource.OnEventCommand(EventCommandEventArgs command)
at System.Diagnostics.Tracing.EventSource.DoCommand(EventCommandEventArgs commandArgs)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
In order to find this problem, I modified the source code locally and output the log when necessary. The code modification is as follows:
public event EventHandler<EventCommandEventArgs>? EventCommandExecuted
{
add
{
if (value == null)
return;
Debug.WriteLine($"EventSource[{GetHashCode()}] add new one {value}({value.GetHashCode()}) from {System.Environment.StackTrace}");
m_eventCommandExecuted += value;
// If we have an EventHandler<EventCommandEventArgs> attached to the EventSource before the first command arrives
// It should get a chance to handle the deferred commands.
EventCommandEventArgs? deferredCommands = m_deferredCommands;
while (deferredCommands != null)
{
Debug.WriteLine($"EventSource[{GetHashCode()}]Invoke deferred command on this value:{deferredCommands}({deferredCommands.GetHashCode()} Command = {deferredCommands.Command})");
value(this, deferredCommands);
deferredCommands = deferredCommands.nextCommand;
}
}
remove
{
Debug.WriteLine($"EventSource[{GetHashCode()}] remove one {value} from {System.Environment.StackTrace}");
m_eventCommandExecuted -= value;
}
}
internal void SendCommand(EventListener? listener, EventProviderType eventProviderType, int perEventSourceSessionId,
EventCommand command, bool enable,
EventLevel level, EventKeywords matchAnyKeyword,
IDictionary<string, string?>? commandArguments)
{
if (!IsSupported)
{
return;
}
var commandArgs = new EventCommandEventArgs(command, commandArguments, this, listener, eventProviderType, perEventSourceSessionId, enable, level, matchAnyKeyword);
lock (EventListener.EventListenersLock)
{
if (m_completelyInited)
{
// After the first command arrive after construction, we are ready to get rid of the deferred commands
this.m_deferredCommands = null;
// We are fully initialized, do the command
DoCommand(commandArgs);
}
else
{
Debug.WriteLine($"EventSource[{GetHashCode()}] Add {commandArgs} {commandArgs.GetHashCode()} Command={commandArgs.Command} to m_deferredCommands in SendCommand:\r\n{System.Environment.StackTrace}");
// We can't do the command, simply remember it and we do it when we are fully constructed.
if (m_deferredCommands == null)
{
m_deferredCommands = commandArgs; // create the first entry
}
else
{
// We have one or more entries, find the last one and add it to that.
EventCommandEventArgs lastCommand = m_deferredCommands;
while (lastCommand.nextCommand != null)
lastCommand = lastCommand.nextCommand;
lastCommand.nextCommand = commandArgs;
}
}
}
}
I added the log and found that the reason was because some Update type Commands were added to m_deferredCommands in advance in EventSource.Initialize. When the code runs to CounterGroup.RegisterCommandCallback, it tries to trigger the command in m_deferredCommands, and then Assert is triggered.
EventSource[-1243760484] Add System.Diagnostics.Tracing.EventCommandEventArgs -923182367 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.NativeRuntimeEventSource..ctor()
at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[-1243760484] Add System.Diagnostics.Tracing.EventCommandEventArgs -1572497824 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.NativeRuntimeEventSource..ctor()
at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[-1243760484] Add System.Diagnostics.Tracing.EventCommandEventArgs 1959724822 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.NativeRuntimeEventSource..ctor()
at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[-1243760484] Add System.Diagnostics.Tracing.EventCommandEventArgs -204200971 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.NativeRuntimeEventSource..ctor()
at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[-1243760484] Add System.Diagnostics.Tracing.EventCommandEventArgs -173953956 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.NativeRuntimeEventSource..ctor()
at System.Diagnostics.Tracing.NativeRuntimeEventSource..cctor()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[2000003047] Add System.Diagnostics.Tracing.EventCommandEventArgs -1391687009 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[2000003047] Add System.Diagnostics.Tracing.EventCommandEventArgs 663802102 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[2000003047] Add System.Diagnostics.Tracing.EventCommandEventArgs 965942388 Command=Update to m_deferredCommands in SendCommand:
at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.SendCommand(EventListener listener, EventProviderType eventProviderType, Int32 perEventSourceSessionId, EventCommand command, Boolean enable, EventLevel level, EventKeywords matchAnyKeyword, IDictionary`2 commandArguments)
at System.Diagnostics.Tracing.EventSource.OverrideEventProvider.OnControllerCommand(ControllerCommand command, IDictionary`2 arguments, Int32 perEventSourceSessionId)
at System.Diagnostics.Tracing.EtwEventProvider.HandleEnableNotification(EventProvider target, Byte* additionalData, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EventProviderImpl.ProviderCallback(EventProvider target, Byte* additionalData, Int32 controlCode, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData)
at System.Diagnostics.Tracing.EtwEventProvider.Callback(Guid* sourceId, Int32 isEnabled, Byte level, Int64 matchAnyKeywords, Int64 matchAllKeywords, EVENT_FILTER_DESCRIPTOR* filterData, Void* callbackContext)
at Interop.Advapi32.EventRegister(Guid* , , Void* , Int64* )
at System.Diagnostics.Tracing.EtwEventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventProvider.Register(EventSource eventSource)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[2000003047] add new one System.EventHandler`1[System.Diagnostics.Tracing.EventCommandEventArgs](70175282) from at System.Environment.get_StackTrace()
at System.Diagnostics.Tracing.EventSource.add_EventCommandExecuted(EventHandler`1 value)
at System.Diagnostics.Tracing.CounterGroup.RegisterCommandCallback()
at System.Diagnostics.Tracing.CounterGroup..ctor(EventSource eventSource)
at System.Diagnostics.Tracing.CounterGroup.GetCounterGroup(EventSource eventSource)
at System.Diagnostics.Tracing.DiagnosticCounter.Publish()
at System.Diagnostics.Tracing.PollingCounter..ctor(String name, EventSource eventSource, Func`1 metricProvider)
at System.Diagnostics.Tracing.RuntimeEventSource.OnEventCommand(EventCommandEventArgs command)
at System.Diagnostics.Tracing.EventSource.DoCommand(EventCommandEventArgs commandArgs)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
EventSource[2000003047]Invoke deferred command on this value:System.Diagnostics.Tracing.EventCommandEventArgs(-1391687009 Command = Enable)
EventSource[2000003047]Invoke deferred command on this value:System.Diagnostics.Tracing.EventCommandEventArgs(663802102 Command = Update)
---- DEBUG ASSERTION FAILED ----
---- Assert Short Message ----
command is:Update, need Enable or Disable.
---- Assert Long Message ----
at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage)
at System.Diagnostics.Debug.Fail(String message, String detailMessage)
at System.Diagnostics.Debug.Assert(Boolean condition, String message, String detailMessage)
at System.Diagnostics.Debug.Assert(Boolean condition, String message)
at System.Diagnostics.Debug.Assert(Boolean condition, AssertInterpolatedStringHandler& message)
at System.Diagnostics.Tracing.CounterGroup.OnEventSourceCommand(Object sender, EventCommandEventArgs e)
at System.Diagnostics.Tracing.EventSource.add_EventCommandExecuted(EventHandler`1 value)
at System.Diagnostics.Tracing.CounterGroup.RegisterCommandCallback()
at System.Diagnostics.Tracing.CounterGroup..ctor(EventSource eventSource)
at System.Diagnostics.Tracing.CounterGroup.GetCounterGroup(EventSource eventSource)
at System.Diagnostics.Tracing.DiagnosticCounter.Publish()
at System.Diagnostics.Tracing.PollingCounter..ctor(String name, EventSource eventSource, Func`1 metricProvider)
at System.Diagnostics.Tracing.RuntimeEventSource.OnEventCommand(EventCommandEventArgs command)
at System.Diagnostics.Tracing.EventSource.DoCommand(EventCommandEventArgs commandArgs)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
Process terminated. Assertion failed.
command is:Update, need Enable or Disable.
at System.Diagnostics.DebugProvider.Fail(String message, String detailMessage)
at System.Diagnostics.Debug.Fail(String message, String detailMessage)
at System.Diagnostics.Debug.Assert(Boolean condition, String message, String detailMessage)
at System.Diagnostics.Debug.Assert(Boolean condition, String message)
at System.Diagnostics.Debug.Assert(Boolean condition, AssertInterpolatedStringHandler& message)
at System.Diagnostics.Tracing.CounterGroup.OnEventSourceCommand(Object sender, EventCommandEventArgs e)
at System.Diagnostics.Tracing.EventSource.add_EventCommandExecuted(EventHandler`1 value)
at System.Diagnostics.Tracing.CounterGroup.RegisterCommandCallback()
at System.Diagnostics.Tracing.CounterGroup..ctor(EventSource eventSource)
at System.Diagnostics.Tracing.CounterGroup.GetCounterGroup(EventSource eventSource)
at System.Diagnostics.Tracing.DiagnosticCounter.Publish()
at System.Diagnostics.Tracing.PollingCounter..ctor(String name, EventSource eventSource, Func`1 metricProvider)
at System.Diagnostics.Tracing.RuntimeEventSource.OnEventCommand(EventCommandEventArgs command)
at System.Diagnostics.Tracing.EventSource.DoCommand(EventCommandEventArgs commandArgs)
at System.Diagnostics.Tracing.EventSource.Initialize(Guid eventSourceGuid, String eventSourceName, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName, EventSourceSettings settings, String[] traits)
at System.Diagnostics.Tracing.EventSource..ctor(Guid eventSourceGuid, String eventSourceName)
at System.Diagnostics.Tracing.RuntimeEventSource..ctor()
at System.Diagnostics.Tracing.RuntimeEventSource.Initialize()
this code is invoked from native mono code:ep_rt_mono_init_finish
void
ep_rt_mono_init_finish (void)
{
if (mono_runtime_get_no_exec ())
return;
// Managed init of diagnostics classes, like registration of RuntimeEventSource (if available).
ERROR_DECL (error);
MonoClass *runtime_event_source = mono_class_from_name_checked (mono_get_corlib (), "System.Diagnostics.Tracing", "RuntimeEventSource", error);
if (is_ok (error) && runtime_event_source) {
MonoMethod *init = mono_class_get_method_from_name_checked (runtime_event_source, "Initialize", -1, 0, error);
if (is_ok (error) && init) {
mono_runtime_try_invoke_handle (init, NULL_HANDLE, NULL, error);
}
}
mono_error_cleanup (error);
}
Reproduction Steps
- build mono runtime/libs with debug configuration
- Directly use mono_jit_init_version to initialize mono runtime
Expected behavior
no Debug.Assert
Actual behavior
Debug.Assert(e.Command == EventCommand.Enable || e.Command == EventCommand.Disable);
in CounterGroup.OnEventSourceCommand.
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
Metadata
Metadata
Assignees
Labels
area-System.Diagnostics.Tracingneeds-author-actionAn issue or pull request that requires more info or actions from the author.An issue or pull request that requires more info or actions from the author.runtime-monospecific to the Mono runtimespecific to the Mono runtime