<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx</link><description>In my previous post I explained how to collect ETW events from URL Rewrite (or any other IIS provider) and then display those structured events in the Event Viewer. Now I want to show you how to collect ETW events using C#. 
 The .NET Framework 3.5 provides</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#10341377</link><pubDate>Sun, 19 Aug 2012 10:19:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10341377</guid><dc:creator>meghraj</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;I want to get the &amp;#39;UserData&amp;#39; section of Ax Dynamics event and do not know where I can get the event format for that section. Can you help with some c# code to get UserData?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10341377" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#10334663</link><pubDate>Mon, 30 Jul 2012 06:08:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10334663</guid><dc:creator>Inopia</dc:creator><description>&lt;p&gt;You use eventRecord.EventHeader.EventDescriptor.Opcode as a key to cache TraceEventInfoWrapper instances. This breaks for a lot of providers (i.e. microsoft-windows-wininet). I had to bypass this caching feature to make it work for me.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10334663" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#10262953</link><pubDate>Wed, 01 Feb 2012 21:03:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10262953</guid><dc:creator>Eamonn J. Casey</dc:creator><description>&lt;p&gt;Any chance you could post some code that finds the machine &amp;amp; user name? I think that it is in the UserContext IntPtr, but I can&amp;#39;t find how large it is and how to parse it.&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Eamonn J.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10262953" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#10247133</link><pubDate>Tue, 13 Dec 2011 11:24:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10247133</guid><dc:creator>Witali</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;many thanks for such a great work.&lt;/p&gt;
&lt;p&gt;I am currently trying to use your library for consuming real-time events generated by the Microsoft-Windows-Offline provider.&lt;/p&gt;
&lt;p&gt;While everything goes well with normal informational events (event id 2002 for instance), I cannot properly read warnings, that is event id 2006. &amp;nbsp;Unfortunately, the UserData section somehow gets cropped and I only get to see a small portion of it, such as &amp;quot;ss denied&amp;quot; as opposed to &amp;quot;Access denied&amp;quot; error message along with additional fields &amp;lt;ResultCode&amp;gt;, &amp;lt;Operations&amp;gt; to name but a few.&lt;/p&gt;
&lt;p&gt;Have you got any idea why this is happening?&lt;/p&gt;
&lt;p&gt;Thank you very much in advance for your help.&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;/p&gt;
&lt;p&gt;Witali&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10247133" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#10158150</link><pubDate>Tue, 26 Apr 2011 14:43:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:10158150</guid><dc:creator>Mukesh Kumar</dc:creator><description>&lt;p&gt;Hi Daniel,&lt;/p&gt;
&lt;p&gt;I am getting the following error while starting the consumer.exe on Windows 7 machine:&lt;/p&gt;
&lt;p&gt;E:\EventTraceWatcher\Consumer\bin\Debug&amp;gt;Consumer.exe&lt;/p&gt;
&lt;p&gt;System.ComponentModel.Win32Exception: The filename, directory name, or volume la&lt;/p&gt;
&lt;p&gt;bel syntax is incorrect&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Samples.Eventing.EventTraceWatcher.StartTracing() in E:\EventTraceWatcher\&lt;/p&gt;
&lt;p&gt;Samples.Eventing\EventTraceWatcher.cs:line 252&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Samples.Eventing.EventTraceWatcher.SetEnabled(Boolean value) in E:\EventTr&lt;/p&gt;
&lt;p&gt;aceWatcher\Samples.Eventing\EventTraceWatcher.cs:line 173&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Samples.Eventing.EventTraceWatcher.Start() in E:\EventTraceWatcher\Samples&lt;/p&gt;
&lt;p&gt;.Eventing\EventTraceWatcher.cs:line 183&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Program.Run() in E:\EventTraceWatcher\Consumer\Program.cs:line 38&lt;/p&gt;
&lt;p&gt; &amp;nbsp; at Program.Main() in E:\EventTraceWatcher\Consumer\Program.cs:line 11&lt;/p&gt;
&lt;p&gt;Can somebody let me know what am i missing here?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=10158150" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#9960908</link><pubDate>Wed, 10 Feb 2010 01:27:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9960908</guid><dc:creator>jamlou2</dc:creator><description>&lt;p&gt;really great tool, much appreciated.&lt;/p&gt;
&lt;p&gt;i wanted to go further than that, what should be done so that this library would also consume WPP messages sent through DoTraceMessage() &lt;/p&gt;
&lt;p&gt;considering the event session is already created, and there is an application running and sending WPP messages, what should be changed in the implementation so that it would successfully consume those messages?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9960908" width="1" height="1"&gt;</description></item><item><title>Consume IIS ETW tracing</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#9618788</link><pubDate>Fri, 15 May 2009 19:00:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9618788</guid><dc:creator>Eok's Blog</dc:creator><description>&lt;p&gt;Event Tracing for Windows (ETW) is wonderful mechanism to monitor, log and trouble shoot of your application&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9618788" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#9474736</link><pubDate>Sat, 14 Mar 2009 08:26:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9474736</guid><dc:creator>aractnido</dc:creator><description>&lt;p&gt;Thank you dixi for your comments, I haven't test it in Windows 7, but I will give it a try as soon as I can.&lt;/p&gt;
&lt;p&gt;WalkerC, unfortunately this code won't work for XP, I'm using the field ProcessTraceMode and callback EventRecordCallback &lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/library/aa363780"&gt;http://msdn.microsoft.com/en-us/library/aa363780&lt;/a&gt;(VS.85).aspx that are not available prior Windows Vista.&lt;/p&gt;
&lt;p&gt;Thank you.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9474736" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#9463131</link><pubDate>Fri, 06 Mar 2009 20:30:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9463131</guid><dc:creator>dixi</dc:creator><description>&lt;p&gt;An extraordinary and very useful piece of work. Congrats Daniel. I noticed that some people are having troubles with the class in Win7. Actually, I have been troubles with ETW in Win7. It happens that the same .NET 3.5 code I developed works seamlessly in WS2008 but not in Win7. The Beta I gues? Anyway, still trying...&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9463131" width="1" height="1"&gt;</description></item><item><title>re: How to consume ETW events from C#</title><link>http://blogs.msdn.com/b/danielvl/archive/2009/02/02/how-to-consume-etw-events-from-c.aspx#9451517</link><pubDate>Sun, 01 Mar 2009 04:00:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9451517</guid><dc:creator>walkerc</dc:creator><description>&lt;p&gt;OK, new years resolution, become more familar with code before commenting on it...&lt;/p&gt;
&lt;p&gt;1) _logFile.EventRecordCallback = EventRecordCallback; is using a delegate.&lt;/p&gt;
&lt;p&gt;2) int error = NativeMethods.ProcessTrace(array, 1, IntPtr.Zero, IntPtr.Zero); in ProcessTraceInBackground &amp;nbsp;&lt;/p&gt;
&lt;p&gt;blocks. &lt;/p&gt;
&lt;p&gt;It does not matter if EventTraceWatcher.enabled (and in turn, StartTracing and NativeMethods.ProcessTrace is called from a separate external thread or as originally implemented.&lt;/p&gt;
&lt;p&gt;3) ProcessTrace still fails in XP and reason is still a mystery to me.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9451517" width="1" height="1"&gt;</description></item></channel></rss>