<?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>ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx</link><description>One of the synchronization methods in .NET is the ResetEvent. It comes in two flavors, the AutoResetEvent which resets itself immediately after it is set, and the ManualResetEvent which as the name suggests you have to manually reset. Lets say you have</description><dc:language>sv-SE</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Link Listing - March 12, 2008</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8179477</link><pubDate>Thu, 13 Mar 2008 10:13:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8179477</guid><dc:creator>Christopher Steen</dc:creator><description>&lt;p&gt;AJAX Firefox 3.0 XmlHttpRequest Default Content-Type change [Via: Rick Strahl ] ASP.NET Importing an...&lt;/p&gt;
</description></item><item><title>Interesting Finds: 2008.03.17</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8277185</link><pubDate>Mon, 17 Mar 2008 05:00:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8277185</guid><dc:creator>Yuanjian</dc:creator><description>&lt;p&gt;.NET: LINQ Framework Design Guidelines 使用 Visual Studio 分析器找出应用程序瓶颈 Add Support for &amp;amp;quot;Set&amp;amp;quot; Collections&lt;/p&gt;
</description></item><item><title>Interesting Finds: 2008.03.17</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8277206</link><pubDate>Mon, 17 Mar 2008 05:01:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8277206</guid><dc:creator>gOODiDEA</dc:creator><description>&lt;p&gt;.NET:LINQFrameworkDesignGuidelines使用VisualStudio分析器找出应用程序瓶颈AddSupportfor&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8312257</link><pubDate>Tue, 18 Mar 2008 13:33:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8312257</guid><dc:creator>GProssliner</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;I would have two questions about .NET Debugging. Maybe you have a minute to answer them.&lt;/p&gt;
&lt;p&gt;1. An a production Machine it was required to debug an issue (I had to check if an web-request had the proper client-certificates attached to it). I came to the conclusion, that generating a dump on a breakpoint would be the best way to check this, because generating a Dump on every 1st chance would be an overkill, and it would leave the application in a nearly unusable state.&lt;/p&gt;
&lt;p&gt;First I wanted to pass the name of the managed Method (e.g. System.Collections.ArrayList.Add) directly to the &amp;quot;bp&amp;quot; command. I tried &amp;quot;System.Collections.ArrayList.Add&amp;quot;, and &amp;quot;System::Collections::ArrayList.Add&amp;quot;, but I was not able to get the breakpoint bound to the actual method. It there another Syntax for this? Is there also a special syntax for generics?&lt;/p&gt;
&lt;p&gt;Then I used Name2EE to get the the &amp;quot;JITTED Code Address&amp;quot; and set an breakpoint on this address:&lt;/p&gt;
&lt;p&gt;bp XXXXXXXX &amp;quot;.dump -u /ma C:\\DUMPFILE.dmp;g;&amp;quot;&lt;/p&gt;
&lt;p&gt;Everything worked so far, but I wanted to automate the complete procedure, because the time the application is down (waiting for debugger-commands) shall be as low as possible. So I wanted to extract the &amp;quot;JITTED Code Address&amp;quot; and use it as an argument for the Breakpoint Action.&lt;/p&gt;
&lt;p&gt;This is what I've now:&lt;/p&gt;
&lt;p&gt;.foreach /pS 0C (v {!Name2EE mscorlib.dll System.Collections.ArrayList.Add}){bp v &amp;quot;.dump -u /ma C:\\DUMPFILE.dmp;g;&amp;quot;;.break;}&lt;/p&gt;
&lt;p&gt;Just skipping the first 13 tokens within the Name2EE Output seems to be not a very stable solution. Isn't there a method to search for a specific pattern (e.g. &amp;quot;Code Address&amp;quot;)? This would be much better in my case.&lt;/p&gt;
&lt;p&gt;The second question is if the Attaching to the process can also be scripted. I've seen the .attach and .tlist commands. The following snippet should to the job: &lt;/p&gt;
&lt;p&gt;.foreach(pid {.tlist *\Test.exe}){.attach pid;.break;}&lt;/p&gt;
&lt;p&gt;I've tried putting everything into on file:&lt;/p&gt;
&lt;p&gt;.loadby sos mscorwks&lt;/p&gt;
&lt;p&gt;.foreach(pid {.tlist *\Test.exe}){.attach pid;.break;}&lt;/p&gt;
&lt;p&gt;.foreach /pS 0C (v {!Name2EE mscorlib.dll System.Collections.ArrayList.Add}){bp v &amp;quot;.dump -u /ma C:\\DUMPFILE.dmp;g;&amp;quot;;.break;}&lt;/p&gt;
&lt;p&gt;g&lt;/p&gt;
&lt;p&gt;and to call it from the command-line on cdb:&lt;/p&gt;
&lt;p&gt;cdb -cf test.script but it doesn't work (I just get the Syntax-Help). Do you know what is wrong with it?&lt;/p&gt;
&lt;p&gt;Thank you!&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8313169</link><pubDate>Tue, 18 Mar 2008 14:32:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8313169</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;To set a breakpoint on a managed function you can use !bpmd from sos.dll for example !bpmd myapp.exe MyApp.Main&lt;/p&gt;
&lt;p&gt;Attach to a process, load up sos.dll and run !help bpmd to see what you need to do (you need to make sure that mscorlib is loaded first etc.)&lt;/p&gt;
&lt;p&gt;The easiest way to create a configuration file to set breakpoints on certain things is probably to create an adplus configuration file. &amp;nbsp;There you can also set up precommands like .load sos etc. that happen directly on attach.... have a look at the windbg help section for adplus to see how this is done... &lt;/p&gt;
&lt;p&gt;Tess&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8313208</link><pubDate>Tue, 18 Mar 2008 14:35:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8313208</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;also, attaching and running commands will only work if you attach to a process first, and i think that might be what is missing in your script... &amp;nbsp; you can run the commandline tlist.exe and parse the output in a batch file and then use pass the appropriate pid etc. to cdb to attach to it if that is what you are looking for&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#8317779</link><pubDate>Tue, 18 Mar 2008 19:54:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8317779</guid><dc:creator>GProssliner</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;Thank you for your answer!&lt;/p&gt;
&lt;p&gt;I know the !bpmd Command. But unlike to the bp Command, an action (like .dump and G)cannot be specified, or am I missing something?&lt;/p&gt;
&lt;p&gt;If I understand you correctly, a script only gets executed when a process is attached? I already thought about that, but what makes me think that that I can do it from the script is the fact that there is a .attach command in windbg. Whatever.... The idea with tlist.exe and a .cmd file sounds very interesting. I'll give it a try!&lt;/p&gt;</description></item><item><title>re: ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#9597126</link><pubDate>Fri, 08 May 2009 18:15:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9597126</guid><dc:creator>Brian Riviere</dc:creator><description>&lt;p&gt;So would the Hang on WaitOne show a High CPU usage?&lt;/p&gt;
</description></item><item><title>re: ASP.NET Case Study: Hang on WaitOne, WaitAny or WaitMultiple</title><link>http://blogs.msdn.com/tess/archive/2008/03/12/asp-net-case-study-hang-on-waitone-waitany-or-waitmultiple.aspx#9597358</link><pubDate>Fri, 08 May 2009 20:29:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9597358</guid><dc:creator>Tess</dc:creator><description>&lt;p&gt;no, waitone, waitany etc. are low cpu waits, they just sit idle until an event wakes them up&lt;/p&gt;
</description></item></channel></rss>