<?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>[PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx</link><description>During a lab I had about a month ago, one of my colleagues, Tag, whom I had opportunity to mention in a previous post, asked me if I could create a PowerShell script that displays statistics of exceptions, with call stacks included. For me it sounded</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Microsoft news and tips &amp;raquo; [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8395599</link><pubDate>Tue, 15 Apr 2008 03:17:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8395599</guid><dc:creator>Microsoft news and tips &amp;raquo; [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://microsoftnews.askpcdoc.com/?p=2408"&gt;http://microsoftnews.askpcdoc.com/?p=2408&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>Interesting Finds: April 15, 2008</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8397628</link><pubDate>Tue, 15 Apr 2008 17:18:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8397628</guid><dc:creator>Jason Haley</dc:creator><description /></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8405085</link><pubDate>Fri, 18 Apr 2008 02:12:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8405085</guid><dc:creator>Ed F</dc:creator><description>&lt;p&gt;I was trying to automate the production of the log so I could use it during some automated tests I run, but I can't seem to get cdb to do it.&lt;/p&gt;
&lt;p&gt;I tried it directly on the command line:&lt;/p&gt;
&lt;p&gt;cdb -pn w3wp.exe -c &amp;quot;.load c:\debuggers\psscor2.dll;sxe -c '.echo =&lt;/p&gt;
&lt;p&gt;==StartPrintException;!PrintException;.echo ===FinishPrintException; .echo ===St&lt;/p&gt;
&lt;p&gt;artClrStack;!clrstack; .echo ===StopClrStack;gc' clr&amp;quot;&lt;/p&gt;
&lt;p&gt;which gives me this error:&lt;/p&gt;
&lt;p&gt;0:047&amp;gt; cdb: Reading initial command '.load c:\debuggers\psscor2.dll;sxe -c '.ech&lt;/p&gt;
&lt;p&gt;o ===StartPrintException;!PrintException;.echo ===FinishPrintException; .echo ==&lt;/p&gt;
&lt;p&gt;=StartClrStack;!clrstack; .echo ===StopClrStack;gc' clr'&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^ Syntax error in '.load c:\debugger&lt;/p&gt;
&lt;p&gt;s\psscor2.dll;sxe -c '.echo ===StartPrintException;!PrintException;.echo ===Fini&lt;/p&gt;
&lt;p&gt;shPrintException; .echo ===StartClrStack;!clrstack; .echo ===StopClrStack;gc' cl&lt;/p&gt;
&lt;p&gt;r'&lt;/p&gt;
&lt;p&gt;I tried a script file too:&lt;/p&gt;
&lt;p&gt;cdb -pn w3wp.exe -loga log.txt -cf c:\debuggers\logexceptions.txt&lt;/p&gt;
&lt;p&gt;logexceptions.txt:&lt;/p&gt;
&lt;p&gt;.load c:\debuggers\psscor2.dll&lt;/p&gt;
&lt;p&gt;sxe -c &amp;quot;.echo ===StartPrintException;!PrintException;.echo ===FinishPrintException; .echo ===StartClrStack;!clrstack; .echo ===StopClrStack;gc&amp;quot; clr&lt;/p&gt;
&lt;p&gt;I get this error:&lt;/p&gt;
&lt;p&gt;1\App_Web_pingservice.aspx.e27dd738.pcevj-7k.dll&lt;/p&gt;
&lt;p&gt;Couldn't resolve error at 'clr'&lt;/p&gt;
&lt;p&gt;any ideas or suggestions?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Ed.&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8405706</link><pubDate>Fri, 18 Apr 2008 04:49:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8405706</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;P&gt;I tried the script approach, just copying and pasting it, then replacing the file name. First I got an error because my extesions are in WinExt folder, after fixing it everything worked fine.&lt;/P&gt;
&lt;P&gt;Here it is:&lt;/P&gt;
&lt;P&gt;LogExceptions.txt&lt;/P&gt;
&lt;P&gt;.load c:\debuggers\winext\psscor2.dll&lt;/P&gt;
&lt;P&gt;sxe -c ".echo ===StartPrintException;!PrintException;.echo ===FinishPrintException; .echo ===StartClrStack;!clrstack; .echo ===StopClrStack;gc" clr&lt;/P&gt;
&lt;P&gt;From the debuggers folder:&lt;/P&gt;
&lt;P&gt;cdb -pn netwiz.exe -cf c:\debuggers\logexceptions.txt&lt;/P&gt;
&lt;P&gt;My suggestion for you is to verify if your psscor2.dll extension is actually in c:\debuggers and not in c:\debuggers\winext&lt;/P&gt;
&lt;P&gt;If the directory is right, then try to attach the debugger to a simple .NET application to see if the error is consistent. (this is what I did)&lt;/P&gt;
&lt;P&gt;If you're still getting errors, use WinDbg and attach it to the simple application using the Attach To a Process... option.&lt;/P&gt;
&lt;P&gt;Let me know the outcome.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;Roberto&lt;/P&gt;</description></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8406421</link><pubDate>Fri, 18 Apr 2008 08:04:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8406421</guid><dc:creator>Ed F</dc:creator><description>&lt;p&gt;&amp;lt;embarrassed&amp;gt; it was working. I was just confused because it stopped when I had expected it to keep going. I forgot the gn.&lt;/p&gt;
&lt;p&gt;Is there a way to set a timer? Say to let it run for 10 minutes and then stop?&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8406570</link><pubDate>Fri, 18 Apr 2008 08:55:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8406570</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;p&gt;Cool!&lt;/p&gt;
&lt;p&gt;I'm not aware of any command that does the job... but you just gave me a great idea! :)&lt;/p&gt;
&lt;p&gt;A new cmdlet: Send-PowerDbgCTRL-BREAK&lt;/p&gt;
&lt;p&gt;It's in my To Do list!&lt;/p&gt;
&lt;p&gt;If you want to create you own version, here is my idea as a suggestion: you should create a cmdlet that doesn't use Send-PowerDbgCommand. However, it should reuse the overall concept, except for the logs.&lt;/p&gt;
&lt;p&gt;What I have in mind for Send-PowerDbgCTRL-BREAK is to locate the WinDbg Windows, like Send-PowerDbgCommand, and send a CTRL-BREAK. With more work it could even detect if the CTRL-BREAK actually broke the debugger.&lt;/p&gt;
&lt;p&gt;In theory it should work...&lt;/p&gt;
&lt;p&gt;If it works you can create a simple PowerShell script that uses start-sleep and, after the delay, calls Send-PowerDbgCTRL-BREAK.&lt;/p&gt;
&lt;p&gt;To use it you should attach WinDbg to the application. Change the title to PowerDbg, and use &amp;quot;g&amp;quot; to continue the execution. Then, from PowerShell you'd run your script that uses Send-PowerDbgCTRL-BREAK.&lt;/p&gt;
&lt;p&gt;Again, in theory it should work. :)&lt;/p&gt;
&lt;p&gt;Back to the problem, I wonder if another approach would work for you, at least as a workaround, like a breakpoint with a counter. (I have it done, I just need to post the article)&lt;/p&gt;
</description></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8955745</link><pubDate>Wed, 17 Sep 2008 19:18:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8955745</guid><dc:creator>Brad</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This is great, is there a way to run this against a dump file as well?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#8955772</link><pubDate>Wed, 17 Sep 2008 19:36:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8955772</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;p&gt;No, because the script needs to know the exceptions being thrown during the time (or during a specific timeframe) the application is running. The PowerShell script parses the log file collected during the specific timeframe and creates the statistics.&lt;/p&gt;</description></item><item><title>re: [PowerShell Script] Displaying the Top 5 Exceptions and Up to 5 Different Call Stacks For Each Exception</title><link>http://blogs.msdn.com/debuggingtoolbox/archive/2008/04/14/powershell-script-displaying-the-top-5-exceptions-and-up-to-5-different-call-stacks-for-each-exception.aspx#9066888</link><pubDate>Thu, 13 Nov 2008 21:23:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9066888</guid><dc:creator>Roberto Farah</dc:creator><description>&lt;p&gt;New version just released. Same functionality but now it uses a Progress bar to show progress, instead of points. &lt;/p&gt;
&lt;p&gt;Thanks to Ayax Vargas that changed the code.&lt;/p&gt;
</description></item></channel></rss>