<?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>Programming tidbits: store &amp; retrieve</title><link>http://blogs.msdn.com/oanapl/default.aspx</link><description>Coding &amp; debugging: The more you'll do it, the better you'll do it!</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>WCF Communication Objects states Cheat Sheet</title><link>http://blogs.msdn.com/oanapl/archive/2009/10/30/wcf-communication-objects-states-cheat-sheet.aspx</link><pubDate>Fri, 30 Oct 2009 22:16:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915508</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9915508.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9915508</wfw:commentRss><description>&lt;p&gt;WCF is all about communication objects – channels, listeners, factories, all implement the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.icommunicationobject.aspx"&gt;ICommunicationObject&lt;/a&gt; interface (some through the &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.channels.communicationobject.aspx"&gt;CommunicationObject&lt;/a&gt; class). This provides a base implementation for the basic state machine states and transitions common to all communication-oriented object.&lt;/p&gt;  &lt;p&gt;At any given point in time, the communication objects find themselves in a &lt;a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.communicationstate.aspx"&gt;CommunicationState&lt;/a&gt;. Here is a diagram with the states and the transitions:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/WCFCommunicationObjectsstatesandtransiti_A1F7/image_2.png"&gt;&lt;img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="482" alt="image" src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/WCFCommunicationObjectsstatesandtransiti_A1F7/image_thumb.png" width="422" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;When we look at a communication object in a debugger, we see something like this (some columns and internal objects removed for brevity reasons):&lt;/p&gt;  &lt;p&gt;Name: System.ServiceModel.Channels.ServiceChannel&lt;/p&gt;  &lt;p&gt;Fields:&lt;/p&gt;  &lt;table cellspacing="0" cellpadding="0" border="0"&gt;&lt;tbody&gt;     &lt;tr&gt;       &lt;td width="142"&gt;Type&lt;/td&gt;        &lt;td width="64"&gt;VT&lt;/td&gt;        &lt;td width="118"&gt;Value&lt;/td&gt;        &lt;td width="208"&gt;Name&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;aborted&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;closeCalled&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;onClosingCalled&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;onClosedCalled&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;onOpeningCalled&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;onOpenedCalled&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;raisedClosed&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;raisedClosing&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;raisedFaulted&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Boolean&lt;/td&gt;        &lt;td&gt;1&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;traceOpenAndClose&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.Object&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;000000000131d8e0&lt;/td&gt;        &lt;td&gt;eventSender&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;&lt;font color="#004000"&gt;&lt;strong&gt;System.Int32&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td&gt;&lt;font color="#004000"&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td&gt;&lt;font color="#004000"&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;        &lt;td&gt;&lt;font color="#004000"&gt;&lt;strong&gt;state&lt;/strong&gt;&lt;/font&gt;&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.EventHandler&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;Closed&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.EventHandler&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;Closing&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.EventHandler&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;Faulted&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.EventHandler&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;Opened&lt;/td&gt;     &lt;/tr&gt;      &lt;tr&gt;       &lt;td&gt;System.EventHandler&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;0&lt;/td&gt;        &lt;td&gt;Opening&lt;/td&gt;     &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt; &lt;font size="2"&gt;   &lt;p&gt;     &lt;br /&gt;&lt;/p&gt; In our example, the communication object is in state 2. How does that translate to the actual states? To tell you the truth, I always take some time to map the number to the state, so I started using this cheat sheet:&lt;/font&gt;   &lt;p&gt;&lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CommunicationState      &lt;br /&gt;&lt;/span&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Created = 0,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Opening = 1,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Opened = 2,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Closing = 3,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Closed = 4,     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; Faulted = 5     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;So in our case, the ServiceChannel is Opened. We could identify the state by looking at the other variable – if close called or aborted was called, we can only by in state 4 or 5 and so on. But the cheat sheet makes it simple. &lt;/p&gt;  &lt;p&gt;Hope you find it useful!&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9915508" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/WCF/default.aspx">WCF</category></item><item><title>Microsoft Women’s Leadership and Development Conference</title><link>http://blogs.msdn.com/oanapl/archive/2009/10/29/microsoft-women-s-leadership-and-development-conference.aspx</link><pubDate>Thu, 29 Oct 2009 16:04:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9914774</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9914774.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9914774</wfw:commentRss><description>&lt;P&gt;Every other year, Microsoft organizes a conference for women. Why? Because it recognizes that women more than men feel the need to get inspired by listening to some sessions oriented towards the emotional space and, more to the point, women feel the need to talk to other women, find out what issues those women have and feel that they are not alone. Well, this is more why women participate at the conference. But the conference benefits Microsoft as well, because inspired women are more creative, work harder and more efficiently. &lt;/P&gt;
&lt;P&gt;This year's theme was “Opportunity In Change”. The planning team was formed by volunteers that did a great job – the organization was really well planned, the sessions and the speakers well chosen and from registration to food and networking events everything went flawlessly. &lt;/P&gt;
&lt;P&gt;And I want to share with you some of the things I learned. The conference took 2 days and a half. In the 2 full days, there were a couple of sessions going in parallel. Of course, I chose the sessions that seemed more interesting to me. But I learned that the content and the speaker are not enough to make it a good presentation; in order to inspire you, the information and the delivery must match some internal struggle you are dealing with. There were sessions contained the right info, where the speaker did all the right things to attract and connect to the audience, but that didn’t honestly impress me. And sessions that I found heart reaching did nothing for other women.&lt;/P&gt;
&lt;P&gt;The session I liked most was one by &lt;A href="http://www.nancydsolomon.com/" mce_href="http://www.nancydsolomon.com/"&gt;&lt;FONT color=#0000cc&gt;Nancy D. Solomon&lt;/FONT&gt;&lt;/A&gt;, talking about impact. As a writer, speaker, facilitator and executive coach, Nancy has built her career around one simple question: “What did you come here to do, and are you getting it done?” In this session, she gave us the definition of impact -&amp;nbsp; impact is the fingerprint, not the finger that left the print. Put it simply, it's the consequence of what you do/say/think that matters and not the action/word/thought per se. This was a good point for me, as I have the tendency to look at actions instead of the impact of those actions.&lt;/P&gt;
&lt;P&gt;Another good point: people usually don't know what they want, because nobody asked them and, more importantly, they never asked themselves. This is quite applicable inside Microsoft. I know people that do things because they think that that is what they should be doing: I'll take this job because I'll be better positioned for the next , I'll do this because it will increase my visibility, etc. Very few ask: &lt;B&gt;what do I really want&lt;/B&gt;? She told us about a study that looks at how engaged the employees are. I believe I found &lt;A href="http://www.nbrii.com/blog/EngagedOrDisengagedThatIsTheQuestion.aspx" mce_href="http://www.nbrii.com/blog/EngagedOrDisengagedThatIsTheQuestion.aspx"&gt;&lt;FONT color=#0000cc&gt;the study&lt;/FONT&gt;&lt;/A&gt;, and it says:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;The &lt;A href="http://gmj.gallup.com/" mce_href="http://gmj.gallup.com/"&gt;&lt;FONT color=#0000cc&gt;Gallup Management Journal&lt;/FONT&gt;&lt;/A&gt; publishes a semi-annual Employee Engagement Index. Recent results for the U.S. indicated that: &lt;/P&gt;
&lt;P&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Only 29% of employees are actively engaged in their jobs and feel a passion for their work and a connection to their company. &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; Over half of employees (54%) are not engaged in their work and have essentially “checked out.” They are going through the motions; putting in their time and keeping busy but not working with passion. &lt;BR&gt;•&amp;nbsp;&amp;nbsp;&amp;nbsp; The remaining employees, 17%, are actively disengaged. Such employees act on their unhappiness and undermine the work their engaged co-workers are trying to accomplish. &lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;When it comes to career progress, Nancy sais a lot of people think that personal satisfaction and achievement are on the same axis, and therefore in order to get one, the other will be neglected, Instead, she argues that people move an 2 axes, so it's possible to move to accomplish both if you do what you like.&lt;/P&gt;
&lt;P&gt;&lt;A href="file:///C:/Users/oanapl/AppData/Local/Temp/1/WindowsLiveWriter1286139640/supfiles127BBA89/image[2].png" mce_href="file:///C:/Users/oanapl/AppData/Local/Temp/1/WindowsLiveWriter1286139640/supfiles127BBA89/image[2].png"&gt;&lt;/A&gt;&lt;IMG title="Personal satisfaction / achievement graph" style="WIDTH: 288px; HEIGHT: 288px" height=288 alt="Personal satisfaction / achievement graph" src="http://blogs.msdn.com/photos/oanapl/images/9914792/original.aspx" width=288 mce_src="http://blogs.msdn.com/photos/oanapl/images/9914792/original.aspx"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another session I liked was &lt;A href="http://bonniestjohn.com/" mce_href="http://bonniestjohn.com/"&gt;&lt;FONT color=#0000cc&gt;Bonnie St John&lt;/FONT&gt;&lt;/A&gt;’s one, about achieving peak performance in spite of the fact that life is sometimes tough. This was a very inspiring story: Bonnie had a most interesting life:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Due to a condition called pre-femoral focal disorder, Bonnie had her right leg amputated above the knee when she was only 5 years old. Despite this challenge, she went on to excel as an athlete, a scholar, a mother, and a businesswoman. After graduating &lt;A href="http://en.wikipedia.org/wiki/Magna_Cum_Laude" mce_href="http://en.wikipedia.org/wiki/Magna_Cum_Laude"&gt;&lt;FONT color=#0000cc&gt;Magna Cum Laude&lt;/FONT&gt;&lt;/A&gt; from &lt;A href="http://en.wikipedia.org/wiki/Harvard_University" mce_href="http://en.wikipedia.org/wiki/Harvard_University"&gt;&lt;FONT color=#0000cc&gt;Harvard University&lt;/FONT&gt;&lt;/A&gt; in 1986, Bonnie won a &lt;A href="http://en.wikipedia.org/wiki/Rhodes_Scholarship" mce_href="http://en.wikipedia.org/wiki/Rhodes_Scholarship"&gt;&lt;FONT color=#0000cc&gt;Rhodes Scholarship&lt;/FONT&gt;&lt;/A&gt; to &lt;A href="http://en.wikipedia.org/wiki/Oxford_University" mce_href="http://en.wikipedia.org/wiki/Oxford_University"&gt;&lt;FONT color=#0000cc&gt;Oxford University&lt;/FONT&gt;&lt;/A&gt; where she earned her M.Litt. Degree in Economics in 1990. She worked in the White House during the &lt;A href="http://en.wikipedia.org/wiki/Clinton_administration" mce_href="http://en.wikipedia.org/wiki/Clinton_administration"&gt;&lt;FONT color=#0000cc&gt;Clinton administration&lt;/FONT&gt;&lt;/A&gt; as a Director for the &lt;A href="http://en.wikipedia.org/wiki/National_Economic_Council" mce_href="http://en.wikipedia.org/wiki/National_Economic_Council"&gt;&lt;FONT color=#0000cc&gt;National Economic Council&lt;/FONT&gt;&lt;/A&gt;, and is currently CEO of Courageous Spirit, Inc. Bonnie provides inspirational and motivational keynote speeches to dozens of business organizations annually, touching literally tens of thousands of lives each year with her messages of strength and courage.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The most important take away from her presentation was that if people often compare life with sports, nowadays, companies are better compared with disabilities sports (due to the economic situation that’s not quite pink – in case you haven’t noticed). Companies need to thrive despite their disabilities; same for people. About the people she competed with at Paralympics, she said: "what they don't have doesn't matter". What matters is to do the best with what you have. &lt;/P&gt;
&lt;P&gt;Instead of playing it safe to stay up all the time, it's more important to learn how to get up fast after you fall. &lt;/P&gt;
&lt;P&gt;Now, most of the sessions touched upon some common themes:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Be yourself, and be the best you can be. 
&lt;LI&gt;Take risks, get out of your comfort zone. 
&lt;LI&gt;Enjoy the small moments of life, take time regularly to feel joy and delight. 
&lt;LI&gt;Find and follow your purpose in life to be more efficient. 
&lt;LI&gt;Soft skills impact business performance. A study shows that people give in average 85% off what they could be giving on the job; they put in more depending on the direct manager’s soft skills and the soft skills of people around them. &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;I also loved the quote &lt;A href="http://www.dynamicinteractions.com/about/president" mce_href="http://www.dynamicinteractions.com/about/president"&gt;&lt;FONT color=#0000cc&gt;Mitch Shepard&lt;/FONT&gt;&lt;/A&gt; shared with us at her session about Emotional Intelligence: &lt;STRONG&gt;The cure for exertion is not rest, it’s living wholeheartedly&lt;/STRONG&gt;. I believe I’ll make this my motto.&lt;/P&gt;
&lt;P&gt;Hope this gives you an idea of what happened at the Microsoft conference. Like &lt;A href="http://www.microsoft.com/presspass/exec/brummel/default.aspx" mce_href="http://www.microsoft.com/presspass/exec/brummel/default.aspx"&gt;&lt;FONT color=#0000cc&gt;Lisa Brummel&lt;/FONT&gt;&lt;/A&gt;, Microsoft’s senior VP for HR said at the conference, there are a lot of opportunities for personal development and learning activities in Microsoft; if people don’t know about them, it’s management’s fault; if they know and don’t take advantage of them, it’s their own fault. The women’s conference is an opportunity for women to network and connect with other women, learn and get inspired by different opinions, opportunities, and a variety of experiences. If your company organizes something similar, I highly recommend going.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9914774" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/women/default.aspx">women</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/personal+development/default.aspx">personal development</category></item><item><title>ETW (Event Tracing For Windows) – what it is and useful tools</title><link>http://blogs.msdn.com/oanapl/archive/2009/08/05/etw-event-tracing-for-windows-what-it-is-and-useful-tools.aspx</link><pubDate>Wed, 05 Aug 2009 02:55:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9857533</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9857533.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9857533</wfw:commentRss><description>&lt;P&gt;Event Tracing for Windows is the standard way to trace used by all features of Windows. Like the article &lt;A href="http://msdn.microsoft.com/en-us/magazine/cc163437.aspx" mce_href="http://msdn.microsoft.com/en-us/magazine/cc163437.aspx"&gt;&lt;FONT color=#0000cc&gt;Improve Debugging And Performance Tuning With ETW&lt;/FONT&gt;&lt;/A&gt; explains, ETW is &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;“a general-purpose, high-speed tracing facility provided by the operating system. Using a buffering and logging mechanism implemented in the kernel, ETW provides a tracing mechanism for events raised by both user-mode applications and kernel-mode device drivers. Additionally, ETW gives you the ability to enable and disable logging dynamically, making it easy to perform detailed tracing in production environments without requiring reboots or application restarts. The logging mechanism uses per-processor buffers that are written to disk by an asynchronous writer thread. This allows large-scale server applications to write events with minimum disturbance.”&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The article above explains the ETW architecture (that suffered great improvements since Windows Vista), explaining events and sessions, event providers and event consumers. As a quick overview: an &lt;STRONG&gt;event provider &lt;/STRONG&gt;writes events to ETW sessions (it can be any user-mode application, managed application, driver etc). When events are written, ETW adds more info about the time it took place, process and thread ID that generated it, processor number, and CPU usage data of the logging thread. This info is used by the &lt;STRONG&gt;event consumers &lt;/STRONG&gt;- application that reads log files or listens to a session for real time events and processes them. More about providers at &lt;A href="http://blogs.msdn.com/sudeepg/archive/2009/03/01/etw-trace-providers-when-to-use-what.aspx" mce_href="http://blogs.msdn.com/sudeepg/archive/2009/03/01/etw-trace-providers-when-to-use-what.aspx"&gt;&lt;FONT color=#0000cc&gt;ETW Trace Providers - When to use what&lt;/FONT&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;Since Windows Vista, the event provider APIs are simpler to use and offer richer functionality (like same way to use trace and event logs). To register as an ETW provider, software components need to provide a GUID as a unique identifier and a callback that will be invoked when notifications are enabled. When enabling a provider, a controller can specify &lt;/P&gt;
&lt;P&gt;- a level (1-byte integer) – used to show the severity or verbosity of events (eg. verbose, info, error, critical)&lt;/P&gt;
&lt;P&gt;- keywords (8-byte bit masks) – indicate subcomponents in a provider, so subcomponents can be enabled separately.&lt;/P&gt;
&lt;P&gt;.Net Framework offers a managed ETW provider API (see &lt;A href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventing.aspx" mce_href="http://msdn.microsoft.com/en-us/library/system.diagnostics.eventing.aspx"&gt;&lt;FONT color=#0000cc&gt;System.Diagnostics.Eventing Namespace&lt;/FONT&gt;&lt;/A&gt;).&lt;/P&gt;
&lt;P&gt;Once a provider is installed, users can collect events from the provider using the &lt;A href="http://technet.microsoft.com/en-us/library/cc753820(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc753820(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman tool&lt;/FONT&gt;&lt;/A&gt; or &lt;A href="http://technet.microsoft.com/en-us/library/cc722173(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc722173(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;Reliability and Performance Monitor&lt;/FONT&gt;&lt;/A&gt; (Perfmon in Vista and above). The Event Viewer offers another means for collecting and viewing events. Logman is a controller that offers the following options:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/cc788102(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc788102(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman create&lt;/FONT&gt;&lt;/A&gt; - Create a counter, trace, configuration data collector, or API.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/cc788030(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc788030(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman query&lt;/FONT&gt;&lt;/A&gt; - Query data collector properties.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/cc788121(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc788121(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman start | stop&lt;/FONT&gt;&lt;/A&gt; - Start or stop data collection.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/cc788120(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc788120(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman delete&lt;/FONT&gt;&lt;/A&gt; - Delete an existing data collector.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/cc785463(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc785463(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman update&lt;/FONT&gt;&lt;/A&gt; - Update the properties of an existing data collector.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/cc785450(WS.10).aspx" mce_href="http://technet.microsoft.com/en-us/library/cc785450(WS.10).aspx"&gt;&lt;FONT color=#0000cc&gt;logman import | export&lt;/FONT&gt;&lt;/A&gt; - Import a data collector set from an XML file or export a data collector set to an XML file.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;To read more about logman, try &lt;A href="http://blogs.technet.com/askperf/archive/2008/05/13/two-minute-drill-logman-exe.aspx" mce_href="http://blogs.technet.com/askperf/archive/2008/05/13/two-minute-drill-logman-exe.aspx"&gt;&lt;FONT color=#0000cc&gt;Two Minute Drill: LOGMAN.EXE&lt;/FONT&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://technet.microsoft.com/en-us/library/bb490959.aspx" mce_href="http://technet.microsoft.com/en-us/library/bb490959.aspx"&gt;&lt;FONT color=#0000cc&gt;Tracerpt&lt;/FONT&gt;&lt;/A&gt; can be used to process event trace logs or real-time data from instrumented event trace providers. It generates trace analysis reports and &lt;STRONG&gt;CSV&lt;/STRONG&gt; (comma-delimited) files for the events generated. &lt;A href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07" mce_href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;amp;FamilyID=890cd06b-abf8-4c25-91b2-f8d975cf8c07"&gt;&lt;FONT color=#0000cc&gt;LogParser 2.2&lt;/FONT&gt;&lt;/A&gt; also knows to parse ETW events. &lt;/P&gt;
&lt;P&gt;There are other tools that can help with event logging information, like &lt;A href="http://msdn.microsoft.com/en-us/library/aa969767.aspx#event_trace" mce_href="http://msdn.microsoft.com/en-us/library/aa969767.aspx#event_trace"&gt;&lt;FONT color=#0000cc&gt;Event trace&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;and &lt;A href="http://msdn.microsoft.com/en-us/library/aa969767.aspx#event_trace" mce_href="http://msdn.microsoft.com/en-us/library/aa969767.aspx#event_trace"&gt;&lt;FONT color=#0000cc&gt;ETW Trace Viewer&lt;/FONT&gt;&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;To see an example of how to use ETW, read &lt;A href="http://blogs.msdn.com/sudeepg/archive/2009/02/25/capturing-and-analyzing-an-etw-trace-event-tracing-for-windows.aspx" mce_href="http://blogs.msdn.com/sudeepg/archive/2009/02/25/capturing-and-analyzing-an-etw-trace-event-tracing-for-windows.aspx"&gt;&lt;FONT color=#0000cc&gt;Capturing and analyzing an ETW Trace&lt;/FONT&gt;&lt;/A&gt;&amp;nbsp;article.&lt;/P&gt;
&lt;P&gt;The tools I mentioned so far are useful to&amp;nbsp;get and analyze the traces. From a developer point of view, if you want to&amp;nbsp;generate traces for your software application, you can create a trace source and then write events to it. Using an ETW listener offers huge performance improvements over other trace listeners. For a managed application that uses the existing trace listeners or other custom listeners, the only change is to switch to the EventProviderTraceListener (a configuration change).&amp;nbsp;For a provider with GUID 4a632b62-b345-42d4-56dc-g1sac9hfjr14 (generated and installed&amp;nbsp;by you), the config file can look like this:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;?&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;xml &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;version&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;1.0&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;encoding&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;utf-8&lt;/SPAN&gt;" &lt;SPAN style="COLOR: blue"&gt;?&amp;gt;
&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;configuration&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
  &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;system.diagnostics&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;sources&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
      &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;source &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;MySourceName&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;switchName&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;mySwitch&lt;/SPAN&gt;" 
              &lt;SPAN style="COLOR: red"&gt;switchType&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;System.Diagnostics.SourceSwitch&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
        &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;listeners&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
          &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;remove &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;Default&lt;/SPAN&gt;" &lt;SPAN style="COLOR: blue"&gt;/&amp;gt;
          &amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;add &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;name&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;MyEventProviderTraceListener&lt;/SPAN&gt;"
               &lt;SPAN style="COLOR: red"&gt;type&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;System.Diagnostics.Eventing.EventProviderTraceListener, 
               System.Core, Version=3.5.0.0, Culture=neutral, 
               PublicKeyToken=b77a5c561934e089&lt;/SPAN&gt;"
               &lt;SPAN style="COLOR: red"&gt;initializeData&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;4a632b62-b345-42d4-56dc-g1sac9hfjr14&lt;/SPAN&gt;" &lt;SPAN style="COLOR: blue"&gt;/&amp;gt;
        &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;listeners&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
      &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;source&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;sources&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
    &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;trace &lt;/SPAN&gt;&lt;SPAN style="COLOR: red"&gt;autoflush&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;" &lt;SPAN style="COLOR: red"&gt;indentsize&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;=&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;4&lt;/SPAN&gt;"&lt;SPAN style="COLOR: blue"&gt;/&amp;gt;
  &amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;system.diagnostics&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;
&amp;lt;/&lt;/SPAN&gt;&lt;SPAN style="COLOR: #a31515"&gt;configuration&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;&amp;gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;But more about this in a future post. Stay tuned!&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9857533" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/ETW/default.aspx">ETW</category></item><item><title>Design patterns: How do you notify components about events that happen in different components?</title><link>http://blogs.msdn.com/oanapl/archive/2009/07/03/design-patterns-iobservable-and-iregistrar.aspx</link><pubDate>Fri, 03 Jul 2009 03:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9815496</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9815496.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9815496</wfw:commentRss><description>&lt;P&gt;I recently had to solve these kind of requirements: some components execute actions and at some point in time need to notify other components that certain events happened, so the other components can execute code related to these events. For example, class A executes method ChangeStateOfObjectX, and needs to notify class B when X is changed; then B does a certain action (for example, increments a perf counter that illustrates the number of inner objects in X, or writes an event entry or plays a song) when it’s notified. Let’s call class A the Events Generator (because it generates events :)) and B the Events Consumer (because it takes actions in response to the events generated by A). &lt;/P&gt;
&lt;P&gt;Let’s take a concrete example: the class ProjectProgressTracker keeps track of a project progress – this is the Events Generator; when a task is added, completed or blocked (all internal states that the user doesn’t have access to), it needs to let a monitor system know – the Events Consumer. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: green"&gt;// generates events when a task is added, completed, blocked etc
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProjectProgressTracker &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;static &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Random &lt;/SPAN&gt;r = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Random&lt;/SPAN&gt;((&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;.Now.Ticks);
    &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Task&lt;/SPAN&gt;&amp;gt; tasks;

    &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;ProjectProgressTracker(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] initialTasks) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.tasks = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Task&lt;/SPAN&gt;&amp;gt;();
        &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(initialTasks != &lt;SPAN style="COLOR: blue"&gt;null&lt;/SPAN&gt;)
            &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;s &lt;SPAN style="COLOR: blue"&gt;in &lt;/SPAN&gt;initialTasks)
                &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.tasks.Add(&lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Task&lt;/SPAN&gt;(s));
    }

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;NextAction() {
        &lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;randomNumber = r.Next(10);
        &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(randomNumber &amp;lt; 3)
            &lt;SPAN style="COLOR: green"&gt;// a new task was added
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else if &lt;/SPAN&gt;(randomNumber &amp;gt; 6)
            &lt;SPAN style="COLOR: green"&gt;// a task is blocked
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;else
&lt;/SPAN&gt;            &lt;SPAN style="COLOR: green"&gt;// the task is done
&lt;/SPAN&gt;    }

    &lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Task &lt;/SPAN&gt;{
        &lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;name;
        &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;Task(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;name)
            &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.name = name;
        &lt;SPAN style="COLOR: green"&gt;// other properties &amp;amp; methods
    &lt;/SPAN&gt;}
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;This monitor system – StatusUpdatePublisher, sends mails and updates calendars. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: green"&gt;// the class that reacts to events generated by ProjectProgressTracker
&lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StatusUpdatePublisher &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;OnTaskAdded(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.UpdateCalendar(&lt;SPAN style="COLOR: blue"&gt;true&lt;/SPAN&gt;);
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.SendMail(taskName, &lt;SPAN style="COLOR: #a31515"&gt;"added"&lt;/SPAN&gt;);
    }
    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;OnTaskBlocked(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.SendMail(taskName, &lt;SPAN style="COLOR: #a31515"&gt;"blocked"&lt;/SPAN&gt;);
    }
    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;OnTaskCompleted(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.UpdateCalendar(&lt;SPAN style="COLOR: blue"&gt;false&lt;/SPAN&gt;);
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.SendMail(taskName, &lt;SPAN style="COLOR: #a31515"&gt;"completed"&lt;/SPAN&gt;);
    }

    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;SendMail(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName, &lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;action) {
        &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Task {0} was {1}"&lt;/SPAN&gt;, taskName, action);
    }
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;UpdateCalendar(&lt;SPAN style="COLOR: blue"&gt;bool &lt;/SPAN&gt;taskAdded) {
        &lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Task was {0}"&lt;/SPAN&gt;, taskAdded ? &lt;SPAN style="COLOR: #a31515"&gt;"added" &lt;/SPAN&gt;: &lt;SPAN style="COLOR: #a31515"&gt;"removed"&lt;/SPAN&gt;);
    }
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The 2 functionalities (generator / consumer) are completely separate. &lt;/P&gt;
&lt;P&gt;1. One way to implement this is to pass an Events Consumer object when constructing the Events Generator; then the generator class simply uses the consumer instance to call the desired methods. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProjectProgressTracker &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;static &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Random &lt;/SPAN&gt;r = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Random&lt;/SPAN&gt;((&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;)&lt;SPAN style="COLOR: #2b91af"&gt;DateTime&lt;/SPAN&gt;.Now.Ticks);
    &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Task&lt;/SPAN&gt;&amp;gt; tasks;
    &lt;SPAN style="COLOR: blue"&gt;readonly &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StatusUpdatePublisher &lt;/SPAN&gt;publisher;

    &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;ProjectProgressTracker(
        &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] initialTasks, &lt;SPAN style="COLOR: #2b91af"&gt;StatusUpdatePublisher &lt;/SPAN&gt;publisher) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.publisher = publisher;
        &lt;SPAN style="COLOR: green"&gt;// other functionality, see above
    &lt;/SPAN&gt;}

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;NextAction() {
        &lt;SPAN style="COLOR: green"&gt;// This should be replaced with the actual logic
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;randomNumber = r.Next(10);
        &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(randomNumber &amp;lt; 3)
            publisher.OnTaskAdded(randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;else if &lt;/SPAN&gt;(randomNumber &amp;gt; 6)
            publisher.OnTaskBlocked(randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;else
            &lt;/SPAN&gt;publisher.OnTaskCompleted(randomNumber.ToString());
    }

    &lt;SPAN style="COLOR: green"&gt;// other methods &amp;amp; classes
&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;This works, but makes the events generator class &lt;STRONG&gt;tightly coupled&lt;/STRONG&gt; with the events consumer. Consider now that we want to add another monitor system that generates documentation tasks. If we follow the style above, we should pass it too inside the events generator class so it can call the correct methods. Of course, this model doesn’t scale very well. &lt;/P&gt;
&lt;P&gt;2. Another option is to raise some events at the correct time. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs &lt;/SPAN&gt;: &lt;SPAN style="COLOR: #2b91af"&gt;EventArgs &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;TaskEventArgs(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.TaskName = taskName;
    }
    &lt;SPAN style="COLOR: blue"&gt;public string &lt;/SPAN&gt;TaskName { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;private set&lt;/SPAN&gt;; }
}

&lt;SPAN style="COLOR: blue"&gt;delegate void &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventHandler&lt;/SPAN&gt;(&lt;SPAN style="COLOR: blue"&gt;object &lt;/SPAN&gt;sender, &lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs &lt;/SPAN&gt;e);&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The events generator class has 3 events – for tasks added, completed and blocked. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProjectProgressTracker &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;public event &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventHandler &lt;/SPAN&gt;OnTaskAdded;
    &lt;SPAN style="COLOR: blue"&gt;public event &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventHandler &lt;/SPAN&gt;OnTaskCompleted;
    &lt;SPAN style="COLOR: blue"&gt;public event &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventHandler &lt;/SPAN&gt;OnTaskBlocked;

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;NextAction() {
        &lt;SPAN style="COLOR: green"&gt;// This should be replaced with the actual logic
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;randomNumber = r.Next(10);
        &lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs &lt;/SPAN&gt;eventArgs = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs&lt;/SPAN&gt;(
            randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(randomNumber &amp;lt; 3)
            &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.OnTaskAdded(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;, eventArgs);
        &lt;SPAN style="COLOR: blue"&gt;else if &lt;/SPAN&gt;(randomNumber &amp;gt; 6)
            &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.OnTaskBlocked(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;, eventArgs);
        &lt;SPAN style="COLOR: blue"&gt;else
            this&lt;/SPAN&gt;.OnTaskCompleted(&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;, eventArgs);
    }

    &lt;SPAN style="COLOR: green"&gt;// other methods &amp;amp; classes
&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;Then the user of the class needs to hook up the events to the correct methods in the consumer class.&lt;/P&gt;&lt;PRE class=code&gt;ProjectProgressTracker tracker = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;ProjectProgressTracker(
    &lt;SPAN style="COLOR: blue"&gt;new string&lt;/SPAN&gt;[] {&lt;SPAN style="COLOR: #a31515"&gt;"Gather requirements"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"Prototype"&lt;/SPAN&gt;});
tracker.OnTaskAdded += 
    (&lt;SPAN style="COLOR: blue"&gt;object &lt;/SPAN&gt;o, TaskEventArgs e) =&amp;gt; publisher.OnTaskAdded(e.TaskName);
tracker.OnTaskCompleted += 
    (&lt;SPAN style="COLOR: blue"&gt;object &lt;/SPAN&gt;o, TaskEventArgs e) =&amp;gt; publisher.OnTaskCompleted(e.TaskName);
tracker.OnTaskBlocked += 
    (&lt;SPAN style="COLOR: blue"&gt;object &lt;/SPAN&gt;o, TaskEventArgs e) =&amp;gt; publisher.OnTaskBlocked(e.TaskName); 
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The benefit of this approach is that the generator class is not modified, no matter how many consumer classes we want to add to it. The disadvantage is that the user class needs to hook up all events to the correct implementation in consumers.&lt;/P&gt;
&lt;P&gt;3. Another solution is to use the Observable/Observer pattern. &lt;A href="http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/ObserverObservable.htm" mce_href="http://www.exciton.cs.rice.edu/JavaResources/DesignPatterns/ObserverObservable.htm"&gt;The Observer-Observable design pattern&lt;/A&gt; is a a very useful pattern for maintaining one-way communication between one object and a set of other objects. The observers receive communications from the Observable. Observers do not have a reference back to the Observable, so the communication is strictly from the Observable to the Observers. The observable is the object the Observers are "watching". The Observable maintains some sort of&amp;nbsp; list of references to Observers. That way, the Observable can send a message to all the Observers by calling each of their update methods. &lt;/P&gt;
&lt;P&gt;This is a known pattern, but since it’s not implemented in .Net Framework 3.5, I am just going to define some interfaces that suit my needs.&lt;/P&gt;
&lt;P&gt;Here, the class that generates events is the IObservable&amp;lt;T&amp;gt; and the class that consumes events in IObserver&amp;lt;T&amp;gt;:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;interface &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;IObservable&lt;/SPAN&gt;&amp;lt;T&amp;gt; {
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;Subscribe(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;T&amp;gt; observer);
    &lt;SPAN style="COLOR: blue"&gt;bool &lt;/SPAN&gt;Unsubscribe(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;T&amp;gt; observer);
}

&lt;SPAN style="COLOR: blue"&gt;interface &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;T&amp;gt; {
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;OnNext(T value);
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;In our case, T is a class that contains the state of the task – the name of the task and the action that was taken:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;enum &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskAction &lt;/SPAN&gt;{ Added, Completed, Blocked }
&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;TaskState(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName, &lt;SPAN style="COLOR: #2b91af"&gt;TaskAction &lt;/SPAN&gt;taskAction) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.TaskAction = taskAction;
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.TaskName = taskName;
    }
    &lt;SPAN style="COLOR: blue"&gt;public string &lt;/SPAN&gt;TaskName { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;private set&lt;/SPAN&gt;; }
    &lt;SPAN style="COLOR: blue"&gt;public &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskAction &lt;/SPAN&gt;TaskAction { &lt;SPAN style="COLOR: blue"&gt;get&lt;/SPAN&gt;; &lt;SPAN style="COLOR: blue"&gt;private set&lt;/SPAN&gt;; }
}&lt;/PRE&gt;
&lt;P&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;So our classes change accordingly: the ProjectProgressTracker implements the IObservable interface, and the status update class implements the IObserver interface.&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProjectProgressTracker &lt;/SPAN&gt;: &lt;SPAN style="COLOR: #2b91af"&gt;IObservable&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; {
    &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt;&amp;gt; observers = 
        &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt;&amp;gt;();

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;Subscribe(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; observer) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.observers.Add(observer);
    }
    &lt;SPAN style="COLOR: blue"&gt;public bool &lt;/SPAN&gt;Unsubscribe(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; observer) {
        &lt;SPAN style="COLOR: blue"&gt;return this&lt;/SPAN&gt;.observers.Remove(observer);
    }

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;NextAction() {
        &lt;SPAN style="COLOR: green"&gt;// This should be replaced with the actual logic
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;randomNumber = r.Next(10);
        &lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs &lt;/SPAN&gt;eventArgs = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs&lt;/SPAN&gt;(
            randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(randomNumber &amp;lt; 3)
            &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; observer &lt;SPAN style="COLOR: blue"&gt;in this&lt;/SPAN&gt;.observers)
                observer.OnNext(
                    &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;(randomNumber.ToString(), &lt;SPAN style="COLOR: #2b91af"&gt;TaskAction&lt;/SPAN&gt;.Added));
        &lt;SPAN style="COLOR: blue"&gt;else if &lt;/SPAN&gt;(randomNumber &amp;gt; 6)
            &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; observer &lt;SPAN style="COLOR: blue"&gt;in this&lt;/SPAN&gt;.observers)
                observer.OnNext(
                    &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;(randomNumber.ToString(), &lt;SPAN style="COLOR: #2b91af"&gt;TaskAction&lt;/SPAN&gt;.Blocked));
        &lt;SPAN style="COLOR: blue"&gt;else
            foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; observer &lt;SPAN style="COLOR: blue"&gt;in this&lt;/SPAN&gt;.observers)
                observer.OnNext(
                    &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;(randomNumber.ToString(), &lt;SPAN style="COLOR: #2b91af"&gt;TaskAction&lt;/SPAN&gt;.Completed));
    }

    &lt;SPAN style="COLOR: green"&gt;// other methods &amp;amp; classes
&lt;/SPAN&gt;}

&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StatusUpdatePublisher &lt;/SPAN&gt;: &lt;SPAN style="COLOR: #2b91af"&gt;IObserver&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskState&lt;/SPAN&gt;&amp;gt; {
    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;OnNext(&lt;SPAN style="COLOR: #2b91af"&gt;TaskState &lt;/SPAN&gt;state) {
        &lt;SPAN style="COLOR: blue"&gt;switch &lt;/SPAN&gt;(state.TaskAction) {
            &lt;SPAN style="COLOR: blue"&gt;case &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskAction&lt;/SPAN&gt;.Added:
                &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.OnTaskAdded(state.TaskName); &lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;;
            &lt;SPAN style="COLOR: blue"&gt;case &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskAction&lt;/SPAN&gt;.Blocked:
                &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.OnTaskBlocked(state.TaskName); &lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;;
            &lt;SPAN style="COLOR: blue"&gt;case &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskAction&lt;/SPAN&gt;.Completed:
                &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.OnTaskCompleted(state.TaskName); &lt;SPAN style="COLOR: blue"&gt;break&lt;/SPAN&gt;;
        }
    }

    &lt;SPAN style="COLOR: green"&gt;// the other methods
&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;PRE class=code&gt;&lt;/PRE&gt;
&lt;P&gt;Now the user just constructs the classes and registers the desired consumers:&lt;/P&gt;&lt;PRE class=code&gt;StatusUpdatePublisher publisher = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;StatusUpdatePublisher();
ProjectProgressTracker tracker = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;ProjectProgressTracker(
    &lt;SPAN style="COLOR: blue"&gt;new string&lt;/SPAN&gt;[] {&lt;SPAN style="COLOR: #a31515"&gt;"Gather requirements"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;"Prototype"&lt;/SPAN&gt;});
tracker.Subscribe(publisher);
&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;This pattern has a couple of advantages: &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Multiple consumers can be added easily 
&lt;LI&gt;The events generator doesn’t need to know anything about the consumers; no change in the generator is needed when one or more of the consumers is changed.&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;But we pay the penalty of wrapping the state in a class and then analyzing it in the Observer to see what concrete method to implement. &lt;/P&gt;
&lt;P&gt;4. Another possible implementation is the IRegistrar pattern (Disclaimer: I’m not aware of a pattern with this name described. The name is something I came up with). This is somewhat similar with the IObservable pattern, but instead of a class that wraps the state when the event occurs, we specify an interface for the type of events. &lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;interface &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents &lt;/SPAN&gt;{
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;OnTaskAdded(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName);
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;OnTaskBlocked(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName);
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;OnTaskCompleted(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;taskName);
}

&lt;SPAN style="COLOR: blue"&gt;interface &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;IRegistrar&lt;/SPAN&gt;&amp;lt;T&amp;gt; {
    &lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;Subscribe(T consumer);
    &lt;SPAN style="COLOR: blue"&gt;bool &lt;/SPAN&gt;Unsubscribe(T consumer);
}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The events consumers implement this interface:&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;StatusUpdatePublisher &lt;/SPAN&gt;: IProjectEvents {
    &lt;SPAN style="COLOR: green"&gt;// the original methods
&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The generator class can register consumers that know to consume events of type T (IProjectEvents in our case).&lt;/P&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: blue"&gt;class &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProjectProgressTracker &lt;/SPAN&gt;: &lt;SPAN style="COLOR: #2b91af"&gt;IRegistrar&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents&lt;/SPAN&gt;&amp;gt; {
    &lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents&lt;/SPAN&gt;&amp;gt; consumers = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;List&lt;/SPAN&gt;&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents&lt;/SPAN&gt;&amp;gt;();

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;Subscribe(&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents &lt;/SPAN&gt;consumer) {
        &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.consumers.Add(consumer);
    }
    &lt;SPAN style="COLOR: blue"&gt;public bool &lt;/SPAN&gt;Unsubscribe(&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents &lt;/SPAN&gt;consumer) {
        &lt;SPAN style="COLOR: blue"&gt;return this&lt;/SPAN&gt;.consumers.Remove(consumer);
    }

    &lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;NextAction() {
        &lt;SPAN style="COLOR: green"&gt;// This should be replaced with the actual logic
        &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;int &lt;/SPAN&gt;randomNumber = r.Next(10);
        &lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs &lt;/SPAN&gt;eventArgs = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TaskEventArgs&lt;/SPAN&gt;(
            randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;if &lt;/SPAN&gt;(randomNumber &amp;lt; 3)
            &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents &lt;/SPAN&gt;consumer &lt;SPAN style="COLOR: blue"&gt;in this&lt;/SPAN&gt;.consumers)
                consumer.OnTaskAdded(randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;else if &lt;/SPAN&gt;(randomNumber &amp;gt; 6)
            &lt;SPAN style="COLOR: blue"&gt;foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents &lt;/SPAN&gt;consumer &lt;SPAN style="COLOR: blue"&gt;in this&lt;/SPAN&gt;.consumers)
                consumer.OnTaskBlocked(randomNumber.ToString());
        &lt;SPAN style="COLOR: blue"&gt;else
            foreach &lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;IProjectEvents &lt;/SPAN&gt;consumer &lt;SPAN style="COLOR: blue"&gt;in this&lt;/SPAN&gt;.consumers)
                consumer.OnTaskCompleted(randomNumber.ToString());
    }

    &lt;SPAN style="COLOR: green"&gt;// other methods &amp;amp; classes
&lt;/SPAN&gt;}&lt;/PRE&gt;&lt;A href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;The usage is just as the one for the IObservable pattern. &lt;/P&gt;
&lt;P&gt;In our case, it seems that this pattern works the best, because we get all the previous advantages plus strongly typing when calling consumer methods. &lt;/P&gt;
&lt;P&gt;Depending on your project requirements, you may choose one of these solutions or look for a better one. Some requirements may be:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Loosely coupling between the events generator and the consumers 
&lt;UL&gt;
&lt;LI&gt;Changing the consumer doesn’t affect the generator&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;One or more consumers can be added 
&lt;LI&gt;Producers can have inner producers and the consumers must be propagated 
&lt;LI&gt;Etc… who knows?&lt;/LI&gt;&lt;/UL&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9815496" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Design+patterns/default.aspx">Design patterns</category></item><item><title>.NET Framework 4.0 implements WS-Discovery</title><link>http://blogs.msdn.com/oanapl/archive/2009/06/11/net-framework-4-0-implements-ws-discovery.aspx</link><pubDate>Fri, 12 Jun 2009 00:52:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9727941</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9727941.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9727941</wfw:commentRss><description>&lt;p&gt;The &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx"&gt;.NET Framework 4.0 and Visual Studio 2010 Beta 1&lt;/a&gt; are live. If you haven’t tried the bits, do so and give the team &lt;a href="http://go.microsoft.com/fwlink/?LinkID=151484"&gt;feedback&lt;/a&gt;. There are some very cool features added – just take a look at the &lt;a href="http://msdn.microsoft.com/en-us/library/dd409230(VS.100).aspx"&gt;highlights&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;On the Communications front, Windows Communication Foundation has 3 major new features: support for WS-Discovery, standard endpoints (pre-defined endpoints with some of the properties fixed) and workflow services (messaging activities make the implementation of workflows very easy). &lt;/p&gt;  &lt;p&gt;I am really excited with the support for the &lt;a href="http://docs.oasis-open.org/ws-dd/discovery/1.1/cs-01/wsdd-discovery-1.1-spec-cs-01.pdf"&gt;WS-Discovery protocol&lt;/a&gt;. From the msdn documentation:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;“The Service Discovery feature enables client applications to dynamically discover service addresses at run time in an interoperable way using WS-Discovery. The WS-Discovery specification outlines the message-exchange patterns (MEPs) required for performing lightweight discovery of services, both by multicast (ad hoc) and unicast (using a network resource).”&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;To learn more about Discovery, take a at the &lt;a href="http://msdn.microsoft.com/en-us/library/dd483326%28VS.100%29.aspx"&gt;Discovery MSDN SDK samples&lt;/a&gt;. Plus, the Discovery team is blogging, so go to the &lt;a href="http://blogs.msdn.com/discovery/"&gt;Discovery team’s blog&lt;/a&gt;. Or start with the &lt;a href="http://channel9.msdn.com/shows/Endpoint/endpointtv-Service-Discovery-with-WCF/"&gt;Channel9 Discovery video&lt;/a&gt;:&lt;/p&gt;  &lt;p&gt;&lt;a title="Service Discovery with WCF" href="http://channel9.msdn.com/shows/Endpoint/endpointtv-Service-Discovery-with-WCF/"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/NETFramework4.0implementsWSDiscovery_D13F/image_3.png" width="244" height="214" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9727941" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/WS-Discovery/default.aspx">WS-Discovery</category></item><item><title>Performance: Don't trust, don't make assumptions... Measure!</title><link>http://blogs.msdn.com/oanapl/archive/2009/05/08/performance-don-t-trust-don-t-make-assumptions-measure.aspx</link><pubDate>Fri, 08 May 2009 07:25:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9595842</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9595842.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9595842</wfw:commentRss><description>&lt;p&gt;When it comes to performance, there's a hard lesson I had to learn: never trust anyone, measure for yourself! Don't trust the gurus, the MSDN documentation, the technical fellow that wrote the code. Instead, do some simple performance measurements to see what is really going on.&lt;/p&gt;  &lt;p&gt;I had to instrument my C# code with performance counters. I started reading the MSDN &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.increment.aspx"&gt;PerformanceCounter documentation&lt;/a&gt;, and here is what I found out:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;The Increment, &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.incrementby.aspx"&gt;IncrementBy&lt;/a&gt;, and &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.decrement.aspx"&gt;Decrement&lt;/a&gt; methods use interlocks to update the counter value. This helps keep the counter value accurate in multithreaded or multiprocess scenarios, but also results in a performance penalty. If you do not need the accuracy that interlocked operations provide, you can update the &lt;a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.performancecounter.rawvalue.aspx"&gt;RawValue&lt;/a&gt; property directly for up to a 5 times performance improvement. However, in multithreaded scenarios, some updates to the counter value might be ignored, resulting in inaccurate data. &lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Because the application I instrumented was multithreaded, I didn't want to use the RawValue mechanism. Not much choice to be made, no headache. My application needed to create and cleanup multiple performance counter instances based on certain object instances, and these objects were accessed from multiple threads. Then, my requirements changed: I had to introduce my own locks around perf counters. So the question became: should I use the PerformanceCounter.Increment/Decrement functions inside my lock, or just change the RawValue directly? Based on the documentation, the second option should have been more performant. &lt;/p&gt;  &lt;p&gt;But, like I said: never trust the documentation. So I wrote a simple program to test the 2 methods. First, I created a performance counter category and added a counter to it:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;CounterCreationDataCollection &lt;/span&gt;dataCollection = 
    &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CounterCreationDataCollection&lt;/span&gt;();
dataCollection.Add(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CounterCreationData&lt;/span&gt;(
    &lt;span style="color: #a31515"&gt;&amp;quot;MyCounterName&amp;quot;&lt;/span&gt;, 
    &lt;span style="color: #a31515"&gt;&amp;quot;My special test counter&amp;quot;&lt;/span&gt;, 
    &lt;span style="color: #2b91af"&gt;PerformanceCounterType&lt;/span&gt;.NumberOfItems64));
&lt;span style="color: #2b91af"&gt;PerformanceCounterCategory&lt;/span&gt;.Create(
    &lt;span style="color: #a31515"&gt;&amp;quot;MyCategory&amp;quot;&lt;/span&gt;, 
    &lt;span style="color: #a31515"&gt;&amp;quot;My special test category&amp;quot;&lt;/span&gt;,
    &lt;span style="color: #2b91af"&gt;PerformanceCounterCategoryType&lt;/span&gt;.SingleInstance,
    dataCollection);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Now that the counters are installed, let's start incrementing them. I tested 4 configurations: 1. using RawValue, 2. using RawValue under a lock, 3. using Increment, 4. using Increment under a lock. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PerfCounterOperations
&lt;/span&gt;{
    Increment,
    IncrementLock,
    Raw,
    RawLock
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;I created a disposable class that instantiates a performance counter in our installed category. &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Diagnostics;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Threading;

&lt;span style="color: blue"&gt;sealed class &lt;/span&gt;PerfCounterWrapper : IDisposable
{
    &lt;span style="color: blue"&gt;static &lt;/span&gt;Stopwatch watch = &lt;span style="color: blue"&gt;new &lt;/span&gt;Stopwatch();
    &lt;span style="color: blue"&gt;int &lt;/span&gt;noRepetitions = 10000;

    &lt;span style="color: blue"&gt;readonly &lt;/span&gt;PerformanceCounter perfCounter;
    &lt;span style="color: blue"&gt;bool &lt;/span&gt;enabled;
    &lt;span style="color: blue"&gt;readonly object &lt;/span&gt;thisLock;

    &lt;span style="color: blue"&gt;public &lt;/span&gt;PerfCounterWrapper()
    {
        &lt;span style="color: blue"&gt;this&lt;/span&gt;.thisLock = &lt;span style="color: blue"&gt;new object&lt;/span&gt;();
        &lt;span style="color: blue"&gt;try
        &lt;/span&gt;{
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter = &lt;span style="color: blue"&gt;new &lt;/span&gt;PerformanceCounter(
                &lt;span style="color: #a31515"&gt;&amp;quot;MyCategory&amp;quot;&lt;/span&gt;, 
                &lt;span style="color: #a31515"&gt;&amp;quot;MyCounterName&amp;quot;&lt;/span&gt;, 
                &lt;span style="color: blue"&gt;false&lt;/span&gt;);
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter.RawValue = 0;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
        }
        &lt;span style="color: blue"&gt;catch &lt;/span&gt;(InvalidOperationException ex)
        {
            &lt;span style="color: green"&gt;// The category is not installed 
            // or there isn't enough memory to create the counter
            &lt;/span&gt;Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Error creating counter: {0}&amp;quot;&lt;/span&gt;, ex.ToString());
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled = &lt;span style="color: blue"&gt;false&lt;/span&gt;;
        }
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;Dispose()
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled)
        {
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter.Dispose();
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled = &lt;span style="color: blue"&gt;false&lt;/span&gt;;
        }
    }     .....
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Here is the method that simulates the 4 types of increment operations:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;Increment(&lt;span style="color: blue"&gt;object &lt;/span&gt;perfCounterOperation)
{
    PerfCounterOperations operation = 
        (PerfCounterOperations)perfCounterOperation;
    &lt;span style="color: blue"&gt;switch &lt;/span&gt;(operation)
    {
        &lt;span style="color: blue"&gt;case &lt;/span&gt;PerfCounterOperations.Increment:
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled)
                &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; noRepetitions; i++)
                    &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter.Increment();
            &lt;span style="color: blue"&gt;break&lt;/span&gt;;
        &lt;span style="color: blue"&gt;case &lt;/span&gt;PerfCounterOperations.IncrementLock:
            &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; noRepetitions; i++)
                &lt;span style="color: green"&gt;// We could simplify this, but we don't want to; 
                // requirements: check &amp;quot;enabled&amp;quot; inside the lock
                &lt;/span&gt;&lt;span style="color: blue"&gt;lock &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.thisLock)
                    &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled)
                        &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter.Increment();
            &lt;span style="color: blue"&gt;break&lt;/span&gt;;
        &lt;span style="color: blue"&gt;case &lt;/span&gt;PerfCounterOperations.Raw:
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled)
                &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; noRepetitions; i++)
                    &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter.RawValue += 1;
            &lt;span style="color: blue"&gt;break&lt;/span&gt;;
        &lt;span style="color: blue"&gt;case &lt;/span&gt;PerfCounterOperations.RawLock:
            &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; noRepetitions; i++)
                &lt;span style="color: blue"&gt;lock &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.thisLock)
                    &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.enabled)
                        &lt;span style="color: blue"&gt;this&lt;/span&gt;.perfCounter.RawValue += 1;
            &lt;span style="color: blue"&gt;break&lt;/span&gt;;
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;The class has methods that measure the number of ticks necessary to increment the counters in a loop. I measured the results with and without contention (by starting multiple threads in the first case and just one thread in the second). &lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;IncrementCounterSingleThread(PerfCounterOperations operation)
{
    watch.Reset();
    watch.Start();
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.Increment(operation);
    watch.Stop();
    Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;{0}: {1} ticks&amp;quot;&lt;/span&gt;, operation, watch.ElapsedTicks);
}

&lt;span style="color: blue"&gt;void &lt;/span&gt;IncrementCounterMultipleThreads(PerfCounterOperations operation)
{
    Thread[] t = &lt;span style="color: blue"&gt;new &lt;/span&gt;Thread[10];
    &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; 10; i++)
        t[i] = &lt;span style="color: blue"&gt;new &lt;/span&gt;Thread(&lt;span style="color: blue"&gt;new &lt;/span&gt;ParameterizedThreadStart(&lt;span style="color: blue"&gt;this&lt;/span&gt;.Increment));

    watch.Reset();
    watch.Start();
    &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; 10; i++)
        t[i].Start(operation);

    &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 0; i &amp;lt; 10; i++)
        t[i].Join();

    watch.Stop();
    Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;{0}: {1} ticks&amp;quot;&lt;/span&gt;, operation, watch.ElapsedTicks);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;font face="Courier New" color="#0000ff"&gt;&lt;/font&gt;

&lt;p&gt;Then we just call these methods for the 4 types of operations and get the results.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;void &lt;/span&gt;MeasureOpSingleThread(&lt;span style="color: blue"&gt;int &lt;/span&gt;noRepetitions)
{
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.noRepetitions = noRepetitions;
    Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Single threaded - no contention&amp;quot;&lt;/span&gt;);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterSingleThread(PerfCounterOperations.Raw);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterSingleThread(PerfCounterOperations.RawLock);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterSingleThread(PerfCounterOperations.Increment);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterSingleThread(
            PerfCounterOperations.IncrementLock);
}

&lt;span style="color: blue"&gt;void &lt;/span&gt;MeasureOpMultipleThread(&lt;span style="color: blue"&gt;int &lt;/span&gt;noRepetitions)
{
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.noRepetitions = noRepetitions;
    Console.WriteLine(&lt;span style="color: #a31515"&gt;&amp;quot;Multiple threads - with contention&amp;quot;&lt;/span&gt;);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterMultipleThreads(PerfCounterOperations.Raw);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterMultipleThreads(PerfCounterOperations.RawLock);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterMultipleThreads(PerfCounterOperations.Increment);
    &lt;span style="color: blue"&gt;this&lt;/span&gt;.IncrementCounterMultipleThreads(
            PerfCounterOperations.IncrementLock);
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Lastly, we create a wrapper and measure the operations for different number of repetitions:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;    static void &lt;/span&gt;Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)
    {
        &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;PerfCounterWrapper &lt;/span&gt;p = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PerfCounterWrapper&lt;/span&gt;())
        {
            &lt;span style="color: blue"&gt;for &lt;/span&gt;(&lt;span style="color: blue"&gt;int &lt;/span&gt;i = 5000; i &amp;lt; 100000; i += 5000)
            {
                p.MeasureOpSingleThread(i);
                p.MeasureOpMultipleThread(i);
            }
        }
    }&lt;/pre&gt;

&lt;p&gt;And here are the results:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceDonttrustdontmakeassu.Measure_107B6/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="202" alt="image" src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceDonttrustdontmakeassu.Measure_107B6/image_thumb.png" width="331" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceDonttrustdontmakeassu.Measure_107B6/image_4.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="202" alt="image" src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceDonttrustdontmakeassu.Measure_107B6/image_thumb_1.png" width="331" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Based on our measurements, the MSDN documentation is misleading: accessing the RawValue is slower than using the Increment/Decrement function, both under lock and with no lock.&lt;/p&gt;

&lt;p&gt;Notice that the code is throw away - far from ship quality, doesn't contain code to handle exceptions or corner cases; all I wanted is to write a simple test fast and get some numbers. This is just one example; the general lesson is: when it comes to performance, do your own tests. Measure, measure, measure.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9595842" width="1" height="1"&gt;</description></item><item><title>Fix Corrupted Performance Counters</title><link>http://blogs.msdn.com/oanapl/archive/2009/04/24/fix-corrupted-performance-counters.aspx</link><pubDate>Sat, 25 Apr 2009 00:37:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9567378</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9567378.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9567378</wfw:commentRss><description>&lt;p&gt;As part of the project I am working on, I had to create performance counter categories and counters for monitoring and debugging purposes. So I wrote the code that installs the counters and everything worked as expected on my machines. Then someone told me that the application failed on his machine with this error:&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;ERROR: caught unexpected exception System.ComponentModel.Win32Exception: The configuration registry key is invalid&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160; at System.Diagnostics.PerformanceCounterLib.RegisterFiles(String arg0, Boolean unregister)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160; at System.Diagnostics.PerformanceCounterLib.UnregisterCategory(String categoryName)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160; at System.Diagnostics.PerformanceCounterCategory.Delete(String categoryName)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160; at MyProgram.PerfCountersHelper.DeleteCategory(String categoryName)&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;font color="#ff0000"&gt;&amp;#160;&amp;#160; at MyProgram.PerfCountersHelper.CleanupCategories()&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;I looked at the code and everything seemed fine - before installing the new category, I was looking if a category with the same name exists and if it did, I deleted it. After I scratched my head for a while, I decided to take a look at his machine. And surprise, surprise, perfmon showed that there were some default counters missing, which hinted toward perf counter corruption. &lt;/p&gt;  &lt;p&gt;Performance counters can become corrupted; so if you don't see categories in Perfmon, or they are missing counters, or names are replaces with numbers, you're probably experiencing this phenomena. To fix the issue, run the lodctr tool with the option /R from a commnd prompt with administrative privileges: &lt;strong&gt;LODCTR /R&lt;/strong&gt;    &lt;br /&gt;This command rebuilds the perf registry strings and info from scratch based on the current registry settings and backup INI files.&lt;/p&gt;  &lt;p&gt;If this doesn't work or you need more specific steps, look at the article &lt;a title="http://support.microsoft.com/?kbid=300956" href="http://support.microsoft.com/?kbid=300956"&gt;http://support.microsoft.com/?kbid=300956&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9567378" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Performance+counters/default.aspx">Performance counters</category></item><item><title>Performance Comparison: Regex versus string operations</title><link>http://blogs.msdn.com/oanapl/archive/2009/04/04/performance-comparison-regex-versus-string-operations.aspx</link><pubDate>Sat, 04 Apr 2009 23:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9531533</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9531533.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9531533</wfw:commentRss><description>&lt;P&gt;I consider &lt;A href="http://www.regular-expressions.info/" mce_href="http://www.regular-expressions.info/"&gt;regular expressions&lt;/A&gt; one of the most useful features ever. I use them a lot, not only when coding, but also when editing files and instead of copy and paste. I find the Visual Studio Find/Replace feature with regular expressions really useful as well. In case you are not familiar with it, you can use regular expressions to find and replace characters like this:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_4.png" mce_href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_4.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=282 alt=image src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_thumb_1.png" width=290 border=0 mce_src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_thumb_1.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;In the picture, I used the expression &lt;STRONG&gt;{[^;]+}; &lt;/STRONG&gt;- meaning tag the string formed by any characters until ";" (at least one character) and replace the matching text with "// " followed by the tagged expression, forgetting the last ";". There are a lot of tutorials about regular expressions. I just learned the basics, and now I just try, fail, undo, and try again until I get it right.&lt;/P&gt;
&lt;P&gt;Moving back to coding, &lt;A href="http://msdn.microsoft.com/en-us/library/hs600312(VS.71).aspx" mce_href="http://msdn.microsoft.com/en-us/library/hs600312(VS.71).aspx"&gt;.NET has great support for regular expressions&lt;/A&gt;. The classes are relatively easy to use (though at the beginning I had to play a while to find out how to capture strings in one match and other more advanced features). The biggest advantages I find in using Regex are that it makes parsing input very easy (once you have the regular expression in place) and it makes it much harder to introduce bugs - less code has by definition fewer bugs, and parsing with regular expressions requires less code than the traditional method of parsing strings with different string methods like get substring at different indexes, check that is starts or ends with certain characters etc. &lt;/P&gt;
&lt;P&gt;However, there are cases when the string concatenation and parsing is better than the regular expressions: when the checks are done on a path that is executed a lot (a hot path), and that has strict performance requirements. Why? The regular expressions are slower than string concatenation. &lt;/P&gt;
&lt;P&gt;I did a simple experiment and measured the time needed by regex and strings to perform the same operations. I considered I need to keep data about persons in the format "Firstname:Oana Lastname:Platon Money:2183 UniqueIdentifier:fwsjfjehfjkwh8r378". I have defined a constant that represents this format, and I'll use it to serialize the person data.&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;const&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; nameFormat = &lt;SPAN style="COLOR: #a31515"&gt;"Firstname:{0} Lastname:{1} Money:{2} UniqueIdentifier:{3}"&lt;/SPAN&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;The data must be serialized and deserialized a lot of times (lets say that we need to send the data on the wire frequently or something like that). When deserializing the data, we need to make sure that it respects the pattern and then we need to extract the firstname, lastname etc.&lt;/P&gt;
&lt;P&gt;1. Using &lt;A href="http://msdn.microsoft.com/en-us/library/30wbz966(VS.71).aspx" mce_href="http://msdn.microsoft.com/en-us/library/30wbz966(VS.71).aspx"&gt;regular expressions&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;I defined a regular expression like this:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Regex&lt;/SPAN&gt; regex = &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Regex&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"^Firstname:(\\w+)\\sLastname:(\\w+)\\sMoney:(\\d{1,9})\\sUniqueIdentifier:([\\w-]+)$"&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #2b91af"&gt;RegexOptions&lt;/SPAN&gt;.IgnoreCase | &lt;SPAN style="COLOR: #2b91af"&gt;RegexOptions&lt;/SPAN&gt;.Compiled);&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;Then, the code to parse the expressions and get the desired data is:&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ParseWithRegex(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; description)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Match&lt;/SPAN&gt; m = regex.Match(description);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!m.Success)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArgumentException&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"description doesn't follow the expected format"&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.firstname = m.Groups[1].Value;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.lastname = m.Groups[2].Value;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;.TryParse(m.Groups[3].Value, &lt;SPAN style="COLOR: blue"&gt;out&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.age))&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArgumentException&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"age doesn't have the correct value"&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.uniqueIdentifier = m.Groups[4].Value;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;2. Using string operations &lt;/P&gt;
&lt;P&gt;The verification that the&amp;nbsp;given string respects the format becomes more difficult. In our case, the patters is pretty simple, but imagine that we&amp;nbsp;needed to check an email address or something more complicated. In that case, the code would have had a lot of cases, to follow all possible solutions. &lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ParseWithStrings(&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt; description)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;string&lt;/SPAN&gt;[] parts = description.Split(&lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;char&lt;/SPAN&gt;[] { &lt;SPAN style="COLOR: #a31515"&gt;' '&lt;/SPAN&gt;, &lt;SPAN style="COLOR: #a31515"&gt;'\t'&lt;/SPAN&gt; });&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (parts.Length != 4)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArgumentException&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"description doesn't follow the expected pattern"&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.firstname = parts[0].Substring(parts[0].IndexOf(&lt;SPAN style="COLOR: #a31515"&gt;":"&lt;/SPAN&gt;) + 1);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.lastname = parts[1].Substring(parts[1].IndexOf(&lt;SPAN style="COLOR: #a31515"&gt;":"&lt;/SPAN&gt;) + 1);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt; (!&lt;SPAN style="COLOR: blue"&gt;int&lt;/SPAN&gt;.TryParse(parts[2].Substring(parts[2].IndexOf(&lt;SPAN style="COLOR: #a31515"&gt;":"&lt;/SPAN&gt;) + 1), &lt;SPAN style="COLOR: blue"&gt;out&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.age))&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArgumentException&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"age doesn't have the correct value"&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;this&lt;/SPAN&gt;.uniqueIdentifier = parts[3].Substring(parts[3].IndexOf(&lt;SPAN style="COLOR: #a31515"&gt;":"&lt;/SPAN&gt;) + 1); ;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;}&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P&gt;See that this is much more error prone than the previous code, because it needs to look at a lot of indexes and to substract the desired part of the string.&lt;/P&gt;
&lt;P&gt;However, when I run the 2 methods in a loop and I measure how long they take with a stopwatch (from System.Diagnostics namespace), I get these results:&lt;/P&gt;
&lt;P&gt;&lt;A href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_8.png" mce_href="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_8.png"&gt;&lt;IMG style="BORDER-RIGHT: 0px; BORDER-TOP: 0px; BORDER-LEFT: 0px; BORDER-BOTTOM: 0px" height=260 alt=image src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_thumb_3.png" width=374 border=0 mce_src="http://blogs.msdn.com/blogfiles/oanapl/WindowsLiveWriter/PerformanceComparisonRegexversusstringco_B123/image_thumb_3.png"&gt;&lt;/A&gt; &lt;/P&gt;
&lt;P&gt;In conclusion, when choosing between using traditional string parsing or regular expressions, I would recommend:&lt;/P&gt;
&lt;P&gt;- Start with regular expressions; if the path is not a hot path and doesn't have any strict performance requirements, this is the best choice, since it makes the code easier to read and maintain.&lt;/P&gt;
&lt;P&gt;- If the performance goals are not reached (which means you have performance goals and you measured the performance!), try to improve your regular expressions. For example, adding ^ and $ (to specify that the pattern you are looking for is at the beginning or at the end of the string) when appropriate can improve the performance a lot. Also, make sure you use compiled expressions (if possible).&lt;/P&gt;
&lt;P&gt;- If you are still not in graphic, replace the regular expressions with string concatenation and parsing.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9531533" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/Performance/default.aspx">Performance</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Visual Studio Templates – Add New Item to project</title><link>http://blogs.msdn.com/oanapl/archive/2009/03/06/visual-studio-templates-add-new-item-to-project.aspx</link><pubDate>Fri, 06 Mar 2009 05:24:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9461322</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9461322.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9461322</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;Using Visual Studio to write code requires creating a project (well, you can use Visual Studio without a project, but you won’t get very much past Notepad functionality – there’s not even Intellisense on files) . After creating / opening an existing project, we can add new files (classes, class diagrams, XML files etc) by selecting the &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Project&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; menu, then &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Add New Item&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; (or add Class / Windows Forms / Windows Component or User Control, if this is what you need). After you specify all the details (file name), a file is added with some default text in it. Assuming you have Visual Studio 2008 SP1 installed, the templates that generate this text are stored at &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;and &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; (for x64 machines, look in &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;% ProgramFiles(x86)%&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;). &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;Let’s add a new C# class, &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Tester&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;, to the class library project &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;SimpleTests&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;. By default, in Visual Studio 2008 it will contain the following text:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Collections.Generic;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Linq;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Text;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; SimpleTests&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;Tester&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;This text comes from the Class template. If we look in the &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;ProjectTemplateCache&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; folder, inside &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;CSharp&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; (the language we used to add the class) -&amp;gt; &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Code&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; -&amp;gt; &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;1033&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; -&amp;gt; &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Class.zip&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;, we find a class.cs looking like this:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Collections.Generic;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;$&lt;SPAN style="COLOR: blue"&gt;if&lt;/SPAN&gt;$ ($targetframeworkversion$ == 3.5)&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Linq;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;$endif$&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System.Text;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; $rootnamespace$&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; $safeitemrootname$&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-tab-count: 1"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;This explains the text we get. But how can we customize the default? I really would appreciate some changes:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level1 lfo1; mso-layout-grid-align: none; mso-add-space: auto"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;I don’t want all these usings added by default – I prefer to start without any using statement, and to add them while the code requires them. Of course, I could do it the other way around: add all the usings I think I may need; when I am done coding, remove the unused ones. Visual Studio lets you do that easily by right clicking on the page, selecting &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Organize Usings&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; -&amp;gt; &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Remove Unused Usings&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; (or &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;Remove and Sort&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;). &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; LINE-HEIGHT: normal; mso-list: l0 level1 lfo1; mso-layout-grid-align: none; mso-add-space: auto"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Second, I prefer Usings inside the namespace declaration and I want to add a header to the file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;I can change the Class.cs file and replace the Class.zip in &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;ProjectTemplatesCache&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; folder:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;//------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;// Copyright (c) Oana Platon&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;//------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; $rootnamespace$&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; $safeitemrootname$&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;Then when I reopen Visual Studio and Add a class, I get this file:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none" mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;//------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;// Copyright (c) Oana Platon&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;//------------------------------------------------------------&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;namespace&lt;/SPAN&gt; SimpleTests&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;using&lt;/SPAN&gt; System;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;class&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;MyCustomizedTester&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT face=Calibri size=3&gt;Cool, right?&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;This change will be lost the first time when &lt;SPAN class=Command&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;devenv /installvstemplates&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN; mso-bidi-font-weight: bold"&gt; command is called (this command replaces the &lt;/SPAN&gt;&lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;ItemTemplatesCache&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN; mso-bidi-font-weight: bold"&gt; &lt;SPAN lang=EN&gt;folder with what finds in &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;ItemTemplates&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-ansi-language: EN; mso-bidi-font-weight: bold"&gt; &lt;SPAN lang=EN&gt;folder). To make it permanent, make the change in &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;ItemTemplates &lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN; mso-bidi-font-weight: bold"&gt;folder instead and run &lt;/SPAN&gt;&lt;SPAN class=Command&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;devenv /installvstemplates&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN; mso-bidi-font-weight: bold"&gt; to propagate the change to &lt;/SPAN&gt;&lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;ItemTemplatesCache&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN; mso-bidi-font-weight: bold"&gt;.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9461322" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>Registry Editor Favorites</title><link>http://blogs.msdn.com/oanapl/archive/2009/02/26/registry-editor-favorites.aspx</link><pubDate>Fri, 27 Feb 2009 00:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9447462</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9447462.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9447462</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The registry editor has a very useful functionality that many people overlook – the favorites. You can add the keys you are interested in the favorites category, so that you can access them later with one click. To add a key, navigate to it, then choose Favorites-&amp;gt;Add Favorites from the menu. You can delete the key from the favorites list when you don’t need it anymore.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG title="Registry editor - Favorites menu" style="WIDTH: 700px; HEIGHT: 248px" height=248 alt="Registry editor - Favorites menu" src="http://blogs.msdn.com/photos/oanapl/images/9447474/original.aspx" width=700 mce_src="http://blogs.msdn.com/photos/oanapl/images/9447474/original.aspx "&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The interesting thing is that the favorites are kept into another registry key - &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;. So you can Export this key and open it on another computer to restore your favorites.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt" mce_keep="true"&gt;&lt;IMG title="Registry editor - Export key" style="WIDTH: 851px; HEIGHT: 268px" height=268 alt="Registry editor - Export key" src="http://blogs.msdn.com/photos/oanapl/images/9447472/original.aspx" width=851 mce_src="http://blogs.msdn.com/photos/oanapl/images/9447472/original.aspx"&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9447462" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Registry+Editor/default.aspx">Registry Editor</category></item><item><title>Problems with CLR Windows Error Reporting (WER) Integration</title><link>http://blogs.msdn.com/oanapl/archive/2009/02/01/problems-with-clr-windows-error-reporting-wer-integration.aspx</link><pubDate>Mon, 02 Feb 2009 01:07:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9388786</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9388786.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9388786</wfw:commentRss><description>&lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Like I mentioned in my previous &lt;/font&gt;&lt;a href="http://blogs.msdn.com/oanapl/archive/2009/01/30/windows-error-reporting-wer-and-clr-integration.aspx" mce_href="http://blogs.msdn.com/oanapl/archive/2009/01/30/windows-error-reporting-wer-and-clr-integration.aspx"&gt;&lt;font face="Calibri" color="#0000ff" size="3"&gt;article&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;, CLR integrates WER in order to be able to add managed-specific information in the reports generated on crashes (if you are not familiar with Windows Error Reporting, read more in the article &lt;/font&gt;&lt;a href="http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx" mce_href="http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx"&gt;&lt;font face="Calibri" size="3"&gt;Windows Error Reporting (WER) for developers&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;).&lt;/font&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;The CLR WER integration brings some problems, most of them due to the large matrix of OSs that must be supported. WER was introduced with Windows XP, so for older OSs, CLR must use Dr. Watson. Also, the support in Vista and Windows Server 2008 was enhanced, so there are differences on how CLR leverages WER on these platforms compared to Windows XP and Windows Server 2003. Because of the large matrix, there are some corner cases that are not treated as well as they should.&lt;/font&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font size="3"&gt;&lt;font face="Calibri"&gt;Other problem with WER integration stems from the report parameters. Like I mentioned in &lt;span lang="EN" style="mso-ansi-language: en"&gt;&lt;a href="http://blogs.msdn.com/oanapl/archive/2009/01/30/windows-error-reporting-wer-and-clr-integration.aspx" mce_href="http://blogs.msdn.com/oanapl/archive/2009/01/30/windows-error-reporting-wer-and-clr-integration.aspx"&gt;&lt;font color="#0000ff"&gt;Windows Error Reporting and CLR integration&lt;/font&gt;&lt;/a&gt; article, CLR uses the method desc and the IL offset inside the method to identify the faulting instruction (for native applications, one of the parameters is the hash of the current stack). This can introduce issues if we wrap the code that deals with the error in one function and multiple functions call that function. For example, we have a function DealWithUnexpectedConditions that calls &lt;a href="http://msdn.microsoft.com/en-us/library/ms131100.aspx" mce_href="http://msdn.microsoft.com/en-us/library/ms131100.aspx"&gt;Environment.FailFast&lt;/a&gt; to terminate the process fast. Then any function that meets an unexpected condition, simply calls DealWithUnexpectedConditions.           &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;  &lt;div style="border-right: windowtext 1pt solid; padding-right: 4pt; border-top: windowtext 1pt solid; padding-left: 4pt; background: #f2f2f2; padding-bottom: 1pt; border-left: windowtext 1pt solid; padding-top: 1pt; border-bottom: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;   &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;class &lt;span style="color: #2b91af"&gt;StaticHelper         &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;public static void DealWithUnexpectedConditions(string message)&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Environment&lt;/span&gt;.FailFast(message);&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="margin: 0in 0in 0pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&amp;#8230;&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;     &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;class &lt;span style="color: #2b91af"&gt;Runner         &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;internal void CheckCurrentProcessHealth()&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;if (!CurrentProcess.IsHealthy) &lt;span style="color: green"&gt;// user defined methods&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StaticHelper&lt;/span&gt;.DealWithUnexpectedConditions(&lt;span style="color: #a31515"&gt;&amp;quot;The current process is not healthy&amp;quot;&lt;/span&gt;);&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;     &lt;p&gt;&lt;font face="Courier New"&gt;&amp;#160;&lt;/font&gt;&lt;/p&gt;   &lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;internal void CheckEnvironmentHealth()&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;if (!CurrentEnvironment.IsHealthy) &lt;span style="color: green"&gt;// user defined methods&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;{&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StaticHelper&lt;/span&gt;.DealWithUnexpectedConditions(&lt;span style="color: #a31515"&gt;&amp;quot;The environment has some unexpected properties&amp;quot;&lt;/span&gt;);&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="margin: 0in 0in 0pt"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;}&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-tab-count: 1"&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;/span&gt;&amp;#8230;&lt;/font&gt;&lt;/p&gt;    &lt;p class="Ccode" style="background: #f2f2f2; margin: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;font face="Courier New"&gt;}&lt;span lang="EN" style="mso-ansi-language: en"&gt;         &lt;p&gt;&lt;/p&gt;       &lt;/span&gt;&lt;/font&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Because CLR doesn&amp;#8217;t look at the entire call stack, it will treat a failure due to current process being unhealthy the same way as a failure due to unhealthy environment. The 2 failures will go into the same bucket, so the developer won&amp;#8217;t see 2 different issues.&lt;span style="mso-spacerun: yes"&gt;&amp;#160; &lt;/span&gt;What we want to see is one more parameter that will ensure the categorization is done based on the hash of the current stack, which will take into consideration the callers as well as the current instruction that generated the failure.&lt;/font&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;Another issue with CLR WER integration is that for each change in WER, CLR must update its code. A very useful WER feature is &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb787181(VS.85).aspx"&gt;&lt;font face="Calibri" size="3"&gt;collecting user-mode dumps&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri" size="3"&gt;. Starting with Windows Server 2008 and Windows Vista with Service Pack 1 (SP1), Windows Error Reporting can be configured so that full user-mode dumps are collected and stored locally after a user-mode application crashes. This is done by changing some registry values under &lt;span style="mso-bidi-font-weight: bold"&gt;HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\Windows Error Reporting\LocalDumps&lt;/span&gt; key. So, if you configure these values and a native application crashes, a dump will be generated irrespective of whether Windows Error Reporting is enabled or not. However, no dump is generated in the specified folder when a managed application crashes. Why? The changes in OS happened too late for CLR to be able to update the functionality for current versions; based on their priorities, the feature didn't meet the bar to be introduced as a DCR. .NET Framework 4.0 will not have this functionality on OSs lower that Windows 7. The behavior will probably be added in the version after .NET Framework 4.0.&lt;/font&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style="margin: 0in 0in 10pt"&gt;&lt;font face="Calibri" size="3"&gt;In future versions, CLR will leverage the OS more to generate WER reports. This will ensure more consistency between the managed and native behavior and will make CLR WER integration less error prone.&lt;/font&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9388786" width="1" height="1"&gt;</description></item><item><title>Windows Error Reporting and CLR integration</title><link>http://blogs.msdn.com/oanapl/archive/2009/01/30/windows-error-reporting-wer-and-clr-integration.aspx</link><pubDate>Fri, 30 Jan 2009 21:10:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9385067</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9385067.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9385067</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;Windows Error Reporting (WER) monitors and collects information on crashes and hangs on Windows platforms newer that Windows XP. The information collected can be sent to a server for investigation (read more in &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx" mce_href="http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx"&gt;&lt;FONT face=Calibri size=3&gt;my previous WER article&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;). &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;When creating reports, WER generates some parameters to bucket-ize the failures. Since the OS doesn’t know anything about managed applications, CLR integrates WER and adds these parameters to create correct buckets:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;AppName - The filename of the EXE (e.g., “Explorer.exe”);&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;AppVer – Assembly version number for an managed EXE (major.minor.build.revision) or the PE header version number (e.g. “2.0.40220.13”) for unmanged&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;AppStamp - The timestamp on the executable.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;AsmAndModName – Assembly and module name if the module is part of a multi-module assembly (e.g., “MyAssembly+MyModule.dll”)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;AsmVer - Managed assembly version number of the faulting assembly (major.minor.build.revision)&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;ModStamp - The timestamp of the faulting module.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;MethodDef - MethodDef token for the faulting method, after stripping off the high byte.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Offset - The IL offset of the faulting instruction.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;ExceptionType -&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;The name of the type of the most-inner exception, with "Exception" removed from the end, if present. (E.g., "System.AccessViolation") &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;For example, I have a managed app (TestWERDefaultCategorizationAndDumps) that crashed. A report was created with these parameters:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;B&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: #0066cc; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem signature&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Event Name:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;CLR20r3&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 01:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;XFU1LOPV1B5JQH0HBYGNH00TXWMZP45M&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 02:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;1.0.0.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 03:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;49833e70&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 04:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;TestWERDefaultCategorizationAndDumps&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 05:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;1.0.0.0&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 06:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;49833e70&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 07:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;1&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: silver; mso-highlight: silver"&gt;-&amp;gt; methodDesc&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 08:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;16&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: silver; mso-highlight: silver"&gt;-&amp;gt; offset&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Problem Signature 09:&lt;SPAN style="mso-tab-count: 1"&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; &lt;/SPAN&gt;System.ArgumentNullException&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="BACKGROUND: silver; mso-highlight: silver"&gt;-&amp;gt; exception type&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;OS Version:&lt;SPAN style="mso-tab-count: 1"&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;&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; &lt;/SPAN&gt;6.0.6001.2.1.0.256.4&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt 9pt; LINE-HEIGHT: normal; mso-layout-grid-align: none; tab-stops: .5in 2.0in"&gt;&lt;SPAN style="FONT-SIZE: 9pt; COLOR: black; FONT-FAMILY: 'Segoe UI','sans-serif'"&gt;Locale ID:&lt;SPAN style="mso-tab-count: 1"&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;&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; &lt;/SPAN&gt;1033&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So the application crashed because a System.ArgumentNullException was unhandled. If we attach the debugger to the application (&lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;windbg –pn TestWERDefaultCategorizationAndDumps&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; if the application is running or &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;windbg TestWERDefaultCategorizationAndDumps&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; to start the app under debugger), we can use the offset and the methodDesc to find out what happened. First, we need to load sos &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;(.loadby sos mscorwks&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;) and then we can use &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;!token2ee Module MethodDesc&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; to find out the method that threw. To determine the methodDesc, append 060000 to the number in the report.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;0:000&amp;gt; !token2ee TestWERDefaultCategorizationAndDumps &lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;06000001&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;Module: 0000064280012e20 (TestWERDefaultCategorizationAndDumps.exe)&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;Token: 0x0000000006000001&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;MethodDesc: &lt;SPAN style="BACKGROUND: lime; mso-highlight: lime"&gt;0000064280013580&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;Name: &lt;SPAN style="BACKGROUND: yellow; mso-highlight: yellow"&gt;TestWERDefaultCategorizationAndDumps.Program.ThrowUnhandledException()&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;JITTED Code Address: 00000642801504b0&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;o:p&gt;&lt;FONT face="Courier New"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;So the function that threw the exception is ThrowUnhandledException &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;in class Program (TestWERDefaultCategorizationAndDumps.Program.ThrowUnhandledException). Once we know the method desc, we can dump the IL of the method and see what line failed:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;0:000&amp;gt; !dumpil &lt;SPAN style="BACKGROUND: lime; mso-highlight: lime"&gt;0000064280013580&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;ilAddr = 0000000000eb2050&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;IL_0000: nop &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;IL_0001: ldstr "Thow Argument Null Exception"&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;IL_0006: call System.Console::WriteLine &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;IL_000b: nop &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;IL_000c: ldstr "test"&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;IL_0011: newobj System.ArgumentNullException::.ctor &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=debugger style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="BACKGROUND: olive; mso-highlight: olive"&gt;IL_0016: throw&lt;/SPAN&gt;&lt;SPAN style="FONT-SIZE: 11pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ascii-theme-font: minor-latin; mso-hansi-theme-font: minor-latin"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;The report says the offset is 16, so we look at IL_0016 and we find our throw. If we take a look at the code, it all makes sense:&lt;/FONT&gt;&lt;/P&gt;
&lt;DIV style="BORDER-RIGHT: windowtext 1pt solid; PADDING-RIGHT: 4pt; BORDER-TOP: windowtext 1pt solid; PADDING-LEFT: 4pt; BACKGROUND: #f2f2f2; PADDING-BOTTOM: 1pt; BORDER-LEFT: windowtext 1pt solid; PADDING-TOP: 1pt; BORDER-BOTTOM: windowtext 1pt solid; mso-element: para-border-div; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto; mso-border-shadow: yes"&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="COLOR: blue"&gt;static&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;void&lt;/SPAN&gt; ThrowUnhandledException()&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;{&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Console&lt;/SPAN&gt;.WriteLine(&lt;SPAN style="COLOR: #a31515"&gt;"Thow Argument Null Exception"&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="COLOR: blue"&gt;throw&lt;/SPAN&gt; &lt;SPAN style="COLOR: blue"&gt;new&lt;/SPAN&gt; &lt;SPAN style="COLOR: #2b91af"&gt;ArgumentNullException&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #a31515"&gt;"test"&lt;/SPAN&gt;);&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=Ccode style="BACKGROUND: #f2f2f2; MARGIN: 0in 0in 0pt; mso-shading: white; mso-shading-themecolor: background1; mso-pattern: gray-5 auto"&gt;&lt;FONT face="Courier New"&gt;}&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9385067" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/WER/default.aspx">WER</category></item><item><title>Windows Error Reporting (WER) for developers</title><link>http://blogs.msdn.com/oanapl/archive/2009/01/28/windows-error-reporting-wer-for-developers.aspx</link><pubDate>Wed, 28 Jan 2009 07:56:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9379777</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9379777.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9379777</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Windows Error Reporting is the replacement for Dr. Watson on OSs newer that Windows XP. It monitors failures and collects useful information that can be sent to a server to be analyzed (if the user allows it). This feature helped Microsoft to fix a lot of bugs – due to the reports received, Microsoft was able to prioritize bugs (based on the biggest number of hits or other severity measures) and to solve a lot of problems. What is really cool is that any developer can request the reports for his/her product. &lt;SPAN style="mso-bidi-font-weight: bold"&gt;From&lt;B&gt; &lt;/B&gt;&lt;A href="http://www.microsoft.com/whdc/maintain/WERHelp.mspx" mce_href="http://www.microsoft.com/whdc/maintain/WERHelp.mspx"&gt;Bill Gates at PDC 2003&lt;/A&gt;&lt;B&gt;: &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/B&gt;&lt;/SPAN&gt;&lt;I&gt;“..whenever an application or the system malfunctions, you get the ability to send a report back to Microsoft. We get a lot of those reports, and we've created very good data-management systems to go in and look at those things, and therefore understand what drivers aren't reliable. We allow anyone who has an application that runs on Windows to sign up and get the reports that relate to their application, and we've got winqual.microsoft.com where people can do that.&lt;/I&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;”&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;Here’s how WER works: when a process crashes, WER collects the data and sends it to a server (if the user allows it; by default WER asks for consent). For non-Microsoft programs, this server is &lt;/FONT&gt;&lt;A href="https://winqual.microsoft.com/" mce_href="https://winqual.microsoft.com/"&gt;&lt;FONT face=Calibri size=3&gt;Winqual&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; (Windows Quality Online Services). On the server side: Based on the parameters of the crash, a bucket is created to hold the new error, or the report is added to an already existing bucket (which means someone met this issue before). A developer can analyze the failure; if a solution can’t be found based on the collected data, he/she can request additional information (a dump, registry key values etc). Also, he/she can add a message explaining the failure. When an instance of the same type of crash happens, the server will display the message the developer set and will ask for the additional information if necessary. If the developer finds a solution, at the next crash the server can &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/whdc/maintain/WER/ErrSolution.mspx" mce_href="http://www.microsoft.com/whdc/maintain/WER/ErrSolution.mspx"&gt;&lt;FONT face=Calibri size=3&gt;provide solutions&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; (see diagram below). Read more about &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/whdc/maintain/WER/ErrClass.mspx" mce_href="http://www.microsoft.com/whdc/maintain/WER/ErrClass.mspx"&gt;&lt;FONT face=Calibri size=3&gt;error reports collection and classification&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;IMG title="WER Flow" style="WIDTH: 477px; HEIGHT: 480px" height=480 alt="WER Flow" src="http://blogs.msdn.com/photos/oanapl/images/9379763/original.aspx" width=477 mce_src="http://blogs.msdn.com/photos/oanapl/images/9379763/original.aspx"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;On Vista and above, the user with the crashed program can go to Control Panel -&amp;gt; Problem Reports and Solutions (start wercon.exe) to see what failures happened on the machine.&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;IMG title="Problem Reports and Solutions" style="WIDTH: 456px; HEIGHT: 282px" height=282 alt="Problem Reports and Solutions" src="http://blogs.msdn.com/photos/oanapl/images/9379789/original.aspx" width=456 mce_src="http://blogs.msdn.com/photos/oanapl/images/9379789/original.aspx"&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Here, you&amp;nbsp;can check for solutionsand see identified problems.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;o:p&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG title="Problem Reports and solutions - View problems" style="WIDTH: 640px; HEIGHT: 195px" height=195 alt="Problem Reports and solutions - View problems" src="http://blogs.msdn.com/photos/oanapl/images/9379769/original.aspx" width=640 mce_src="http://blogs.msdn.com/photos/oanapl/images/9379769/original.aspx"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;You can look at the parameters for each issue and see the bucket in which the report was categorized.&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;IMG title="Problem Reports and Solutions - Report Parameters" style="WIDTH: 640px; HEIGHT: 480px" height=480 alt="Problem Reports and Solutions - Report Parameters" src="http://blogs.msdn.com/photos/oanapl/images/9379771/original.aspx" width=640 mce_src="http://blogs.msdn.com/photos/oanapl/images/9379771/original.aspx"&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;As a developer, you can go to Winqual and register to receive reports for failures. But there are other ways you can take advantage of WER. You can configure WER to send the reports to one of your servers, so you can take a look at them directly. For example, imagine you have a couple of machines you want to monitor. You can use &lt;/FONT&gt;&lt;A href="http://www.microsoft.com/systemcenter/operationsmanager/en/us/default.aspx" mce_href="http://www.microsoft.com/systemcenter/operationsmanager/en/us/default.aspx"&gt;&lt;FONT face=Calibri size=3&gt;System Center Operations Manager&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; (SCOM) with &lt;/FONT&gt;&lt;A href="http://technet.microsoft.com/en-us/library/bb309443.aspx" mce_href="http://technet.microsoft.com/en-us/library/bb309443.aspx"&gt;&lt;FONT face=Calibri size=3&gt;Agenteless Error Monitoring&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; (AEM) to transfer all reports to a monitoring server instead of sending them to Winqual. You don’t even have to use Active Directory integration and group policies, but you can manually configure the &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513638(VS.85).aspx"&gt;&lt;FONT face=Calibri size=3&gt;WER registry keys&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; to specify the CorporateWERServer (with the port and the security options you prefer).&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Another way to take advantage of WER is to save the reports locally. For the rest of the article, I will assume that WER is enables (default setting). &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Like I said, WER tries to collect as little data as possible and asks for more only if necessary. But this behavior can be configured. If you need a dump collected at every crash, you can set HKEY_CURRENT_USER\Software\Microsoft\Windows\Windows Error Reporting\ForceQueue to 1 (or the HKLM\Software\Microsoft\Windows\Windows Error Reporting\ForceQueue=1, to apply the settings globally).This will force a dump to be generated and included in the report. The reports are usually saved at %localAppData%\Microsoft\Windows\WER, in 2 directories: ReportArchive, when a server is available or ReportQueue, when the server is not available. From here, the data is transferred to the server. Another way to look at the contents of the generated report, is to use wercon.exe (as explained above). If you want to keep the data locally, just set the server to a non-existing machine (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error Reporting\CorporateWERServer=NonExistingServer). &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;Now what if you want to generate reports on different conditions that a crash? Maybe you are monitoring the event log or some performance counters like CPU or memory and you want to see what happens when the conditions are violated. Or you want to generate more data than just a dump (for example, your applications has a trace file you want to save, or you want to copy event log entries etc)? Well, you’re in luck, because WER has &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb513636(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513636(VS.85).aspx"&gt;&lt;FONT face=Calibri size=3&gt;API&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; you can use. With this API, whenever your desired conditions are met, you can:&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-style: italic"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;Create a report with &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb513625(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513625(VS.85).aspx"&gt;&lt;B&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;WerReportCreate&lt;/FONT&gt;&lt;/B&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-style: italic"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;Take a dump with &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb513622(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513622(VS.85).aspx"&gt;&lt;B&gt;&lt;FONT face=Calibri size=3&gt;WerReportAddDump&lt;/FONT&gt;&lt;/B&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-style: italic"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;Add other files of interest with &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb513623(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513623(VS.85).aspx"&gt;&lt;B&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;WerReportAddFile&lt;/FONT&gt;&lt;/B&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-style: italic"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Set up to 10 parameters that can be used to categorize the failure (the faulting program, the faulting function, stack trace, whatever you consider useful to investigate the issue)&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-bidi-font-style: italic"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN style="mso-bidi-font-style: italic"&gt;&lt;FONT face=Calibri size=3&gt;Close and submit the report with &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/bb513628(VS.85).aspx" mce_href="http://msdn.microsoft.com/en-us/library/bb513628(VS.85).aspx"&gt;&lt;B&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;WerReportSubmit&lt;/FONT&gt;&lt;/B&gt;&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;One thing you must keep in mind (and this was not obvious to me at all, I got burned actually) is that WerReportAddDump will suspend the threads one by one when taking a dump. That can’t ensure a consistent view of the memory - a thread can be suspended and then while the next one is suspended can change memory or do other damage; this is especially troublesome if your application has a lot of threads. It’s your responsibility to suspend all threads if you need a consistent view. Also, it is a good idea to call this function out of process.&lt;/FONT&gt;&lt;/P&gt;&lt;SPAN style="FONT-SIZE: 11pt; LINE-HEIGHT: 115%; FONT-FAMILY: 'Calibri','sans-serif'; mso-fareast-font-family: Calibri; mso-bidi-font-family: 'Times New Roman'; mso-ansi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-ascii-theme-font: minor-latin; mso-fareast-theme-font: minor-latin; mso-hansi-theme-font: minor-latin; mso-fareast-language: EN-US; mso-bidi-language: AR-SA"&gt;Ok, so now you know how to use WER to always generate dumps on failure, send the reports to a server you specify or queue them locally and to build custom reports. Hope you'll find this info useful to debug and monitor issues related to your apps.&lt;/SPAN&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9379777" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Diagnostics/default.aspx">Diagnostics</category><category domain="http://blogs.msdn.com/oanapl/archive/tags/WER/default.aspx">WER</category></item><item><title>Zoom in: what’s wrong with my process?</title><link>http://blogs.msdn.com/oanapl/archive/2009/01/13/zoom-in-what-s-wrong-with-my-process.aspx</link><pubDate>Wed, 14 Jan 2009 00:35:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9317221</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/9317221.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=9317221</wfw:commentRss><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;There are situations when we want to look closely at a process that is running in production environment – when a crash happens or when it just behaves badly (consumes too much memory, too much CPU, it hangs etc). There are multiple tools that can tell us what is wrong:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Event log (Window Key + Run -&amp;gt; type Eventvwr). Here we can see warnings and errors related to our app. This will shed some light in some of the situations, but quite often there are no entries that can help.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Performance monitor (Window Key + Run -&amp;gt; perfmon). We can look at the perf counters that are relevant to our application and the issue we are trying to investigate. In general, it’s a good idea to look at the perf counters to know what the processes are doing, but it won’t give us much insight on why apps crashed.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;A href="http://technet.microsoft.com/en-us/sysinternals/default.aspx" mce_href="http://technet.microsoft.com/en-us/sysinternals/default.aspx"&gt;&lt;FONT face=Calibri size=3&gt;Sysinternal tools&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;. These contain file &amp;amp; disk utilities, process utilities, networking utilities and much more. You can read more about it on &lt;/FONT&gt;&lt;A href="http://blogs.technet.com/markrussinovich/" mce_href="http://blogs.technet.com/markrussinovich/"&gt;&lt;FONT face=Calibri size=3&gt;Mark's blog&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Debuggers (Visual Studio, windbg etc). While developing and testing, the debugger is our best friend. In production however, debugging might not be just as easy. One way to investigate issues is to take dumps when something unexpected happens.&lt;/FONT&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: 10pt 0in 0pt"&gt;&lt;FONT face=Cambria color=#4f81bd size=3&gt;How do we take dumps?&lt;/FONT&gt;&lt;/H3&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;When the process is running under debugger – it has cdb or windbg attached, we can use the &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;.dump&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; command. Most of the times we want a mini-dump. For a managed process, we need to take a full minidump in order to be able to load sos and debug the managed structures. Use the command &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;.dump /ma dumpName.dmp &lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;– it will add full memory data, handle data, unloaded module information, basic memory information, and thread time information to the mini dump. If you want to generate multiple dumps with unique names, a simple trick is to add &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;/u&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; switch, that appends the data, time and PID of the process to the dump name.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;IMG title="Taking Notepad Dump using Windbg" style="WIDTH: 806px; HEIGHT: 489px" height=489 alt="Taking Notepad Dump using Windbg" src="http://blogs.msdn.com/photos/oanapl/images/9317249/original.aspx" width=806 mce_src="http://blogs.msdn.com/photos/oanapl/images/9317249/original.aspx"&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;If the process is not running under debugger, we can:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Attach the debugger – using &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;&amp;lt;debugger&amp;gt; –p PID&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; or &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;&amp;lt;debugger&amp;gt; -pn ProcessName&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;, where &amp;lt;debugger&amp;gt; is cdb or windbg, and then do what I mentioned above. For example, to attach the debugger to the worker process (and you have just one worker process running), use &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;windbg –pn w3wp.exe&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;. If you have multiple processes with the same name, you need to specify the PID of the process you want to attach (Eg &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;windbg –p 1232&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;). After attaching, take the dump and then run &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;.detach&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; to detach without killing the process. If you don’t want to keep running the process, use &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;.q&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; (ends the debugging session and closes the target application).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Use &lt;/FONT&gt;&lt;A href="http://support.microsoft.com/kb/286350" mce_href="http://support.microsoft.com/kb/286350"&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;adplus&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; in hang mode. This will take a snapshot of the process right now (not waiting for a hang or anything), then detaches and leaves the process running: &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;adplus -hang -pn processname.exe&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;If you want to take a dump later, when a crash will occur, use &lt;/FONT&gt;&lt;A href="http://support.microsoft.com/kb/286350" mce_href="http://support.microsoft.com/kb/286350"&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;adplus&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; in crash mode: &lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;adplus –crash -pn processname.exe&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;. This attaches cdb.exe to the process in invasive mode, and waits for the crash – If it happens, it will take a full mini dump. It will also create mini dumps for access violation exceptions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;SPAN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT face=Calibri size=3&gt;Use &lt;/FONT&gt;&lt;A href="https://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;amp;displaylang=en" mce_href="https://www.microsoft.com/downloads/details.aspx?FamilyID=28bd5941-c458-46f1-b24d-f60151d875a3&amp;amp;displaylang=en"&gt;&lt;FONT face=Calibri size=3&gt;DebugDiag&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt;. DebugDiag it’s really easy to use – it has a graphic interface and we can manually take dumps by right-clicking the process in the processes view and by selecting Create Full Userdump. &lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l1 level1 lfo2"&gt;&lt;FONT face=Calibri size=3&gt;&lt;IMG title="DebugDiag: Manually take dump of a process" style="WIDTH: 559px; HEIGHT: 395px" height=395 alt="DebugDiag: Manually take dump of a process" src="http://blogs.msdn.com/photos/oanapl/images/9317236/original.aspx" width=559 mce_src="http://blogs.msdn.com/photos/oanapl/images/9317236/original.aspx"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; With DebugDiag, we can also create crash rules or hag rules (for IIS).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt" mce_keep="true"&gt;&lt;FONT face=Calibri size=3&gt;&amp;nbsp;&lt;IMG title="DebugDiag: crash rule" style="WIDTH: 447px; HEIGHT: 388px" height=388 alt="DebugDiag: crash rule" src="http://blogs.msdn.com/photos/oanapl/images/9317239/original.aspx" width=447 mce_src="http://blogs.msdn.com/photos/oanapl/images/9317239/original.aspx"&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt" mce_keep="true"&gt;&lt;FONT face=Calibri size=3&gt;Take a look at &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx" mce_href="http://blogs.msdn.com/carloc/archive/2007/10/08/ok-now-how-do-i-capture-my-dump.aspx"&gt;&lt;FONT face=Calibri size=3&gt;this post&lt;/FONT&gt;&lt;/A&gt;&lt;FONT face=Calibri size=3&gt; with more details about DebugDiag and AdPlus (including some configuration files for AdPlus that let you control the behavior better).&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;FONT face=Calibri size=3&gt;There are some registry keys we can set to change the processes behavior:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpFirst style="MARGIN: 0in 0in 0pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN class=Command&gt;&lt;SPAN lang=EN style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal; mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Under &lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;&lt;SPAN class=Command&gt;HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\&lt;/SPAN&gt;&lt;SPAN class=Command&gt;&lt;SPAN style="FONT-WEIGHT: normal; COLOR: windowtext; FONT-STYLE: normal"&gt;&lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN class=Command&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;GCFailFastOnOOM&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt; – This DWORD registry key &lt;A href="http://support.microsoft.com/kb/820745/" mce_href="http://support.microsoft.com/kb/820745/"&gt;causes failfast on out of memory conditions&lt;/A&gt; when it is set to a non-zero value:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;1: an event message is logged in the application event log.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;2: you experience a break in the debugger (app calls DebugBreak()).&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1.5in; TEXT-INDENT: -0.25in; mso-list: l0 level3 lfo1; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="FONT-FAMILY: Wingdings; mso-fareast-font-family: Wingdings; mso-bidi-font-family: Wingdings; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;§&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;4: an event message is logged that includes the size of the allocation that failed and the number of bytes in use, like “Failed to allocate x bytes with y bytes in use. Process will be Terminated.” &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT face=Calibri size=3&gt;For more information, see this post on &lt;/FONT&gt;&lt;A href="http://blogs.msdn.com/tom/archive/2008/05/19/asp-net-tips-what-to-gather-to-troubleshoot-part-5-outofmemoryexception.aspx" mce_href="http://blogs.msdn.com/tom/archive/2008/05/19/asp-net-tips-what-to-gather-to-troubleshoot-part-5-outofmemoryexception.aspx"&gt;&lt;FONT face=Calibri size=3&gt;how to debug ASP.NET Out of memory exceptions using DebugDiag and this registry key&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT face=Calibri size=3&gt;DbgJITDebugLaunchSetting &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;- controls whether a debugger should be started and attached to the process that throws an uncaught exception. See &lt;/FONT&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx" mce_href="http://msdn.microsoft.com/en-us/library/2ac5yxx6.aspx"&gt;&lt;FONT face=Calibri color=#0000ff size=3&gt;Enabling JIT-attach Debugging&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; article on MSDN.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpMiddle style="MARGIN: 0in 0in 0pt 1in; TEXT-INDENT: -0.25in; mso-list: l0 level2 lfo1; mso-add-space: auto"&gt;&lt;SPAN lang=EN style="FONT-FAMILY: 'Courier New'; mso-fareast-font-family: 'Courier New'; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT size=3&gt;o&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;DbgManagedDebugger – what debugger is used to debug managed code, if the previous setting shows that a debugger will be started&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoListParagraphCxSpLast style="MARGIN: 0in 0in 10pt 0.5in; TEXT-INDENT: -0.25in; mso-list: l0 level1 lfo1"&gt;&lt;SPAN lang=EN style="mso-fareast-font-family: Calibri; mso-bidi-font-family: Calibri; mso-ascii-font-family: Calibri; mso-hansi-font-family: Calibri; mso-ansi-language: EN"&gt;&lt;SPAN style="mso-list: Ignore"&gt;&lt;FONT face=Calibri size=3&gt;-&lt;/FONT&gt;&lt;SPAN style="FONT: 7pt 'Times New Roman'"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;&lt;SPAN class=Command&gt;&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;HKLM\SOFTWARE\Microsoft\Windows&amp;nbsp;NT\CurrentVersion\AeDebug&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/SPAN&gt; – We can specify the Auto value and &lt;/FONT&gt;&lt;/FONT&gt;&lt;A href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/11500.mspx?mfr=true" mce_href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/11500.mspx?mfr=true"&gt;&lt;FONT face=Calibri size=3&gt;Debugger&lt;/FONT&gt;&lt;/A&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt; key that tells what debugger to be started in case of failure – full path and command arguments. The default value is “drwtsn32 -p %ld -e %ld –g”, that will start Dr Watson. To start Windbg instead, set Auto = 1 and Debugger&lt;STRONG&gt;&lt;EM&gt;&lt;FONT color=#984806&gt;&lt;SPAN class=Command&gt;="C:\Program Files\Debugging Tools for Windows\windbg.exe" -p %ld -e %ld&lt;/SPAN&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/EM&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 10pt"&gt;&lt;SPAN lang=EN style="mso-ansi-language: EN"&gt;&lt;FONT size=3&gt;&lt;FONT face=Calibri&gt;Later on, I will write a post about Windows Error Reporting, and how we can use it to take dumps and create reports.&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9317221" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/Debugging/default.aspx">Debugging</category></item><item><title>Make your site pretty: major CSS headache</title><link>http://blogs.msdn.com/oanapl/archive/2008/10/10/make-your-site-pretty-major-css-headache.aspx</link><pubDate>Fri, 10 Oct 2008 22:27:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8994724</guid><dc:creator>OanaPlaton</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/oanapl/comments/8994724.aspx</comments><wfw:commentRss>http://blogs.msdn.com/oanapl/commentrss.aspx?PostID=8994724</wfw:commentRss><description>&lt;P&gt;Is it just me or most developers like to implement functionality and logic for their websites and freak out when they have to make it pretty? I personally hate writing style sheets – CSS may sound easy, and I understand the concepts, but don't ask me to apply them. &lt;A href="http://csszengarden.com/" mce_href="http://csszengarden.com/"&gt;CSS Zen Garden&lt;/A&gt; is a demonstration of what can be achieved with CSS, and it's really impressive. &lt;/P&gt;
&lt;P&gt;The strange thing is that CSS looks easy; but when I have to write them, the headache hits. I start to diligently work to make my pages pretty in one browser, I somewhat succeed and then try a different browser – total disaster. &lt;/P&gt;
&lt;P&gt;&lt;A href="http://osbornm.com/blog" mce_href="http://osbornm.com/blog"&gt;Matthew Osborn&lt;/A&gt;, a colleague in the ASP.NET team, wrote some simple web sites with CSS lessons. Take a look at &lt;A href="http://css101.osbornm.com/" mce_href="http://css101.osbornm.com/"&gt;http://css101.osbornm.com/&lt;/A&gt; and &lt;A href="http://css201.osbornm.com/" mce_href="http://css201.osbornm.com/"&gt;http://css201.osbornm.com/&lt;/A&gt;. He also recorded some webcasts: &lt;A href="http://osbornm.com/blog/archive/2008/09/22/css-101-the-basics.aspx" mce_href="http://osbornm.com/blog/archive/2008/09/22/css-101-the-basics.aspx"&gt;&lt;EM&gt;CSS 101: The Basics &lt;/EM&gt;screen cast&lt;/A&gt; &amp;amp; &lt;A href="http://blog.osbornm.com/archive/2008/09/29/css201-theory-and-practice.aspx" mce_href="http://blog.osbornm.com/archive/2008/09/29/css201-theory-and-practice.aspx"&gt;CSS 210: Theory and Practice screen cast&lt;/A&gt;. &lt;/P&gt;
&lt;P&gt;For a simple tip, if you need to test your website in multiple versions of Internet Explorer, you can use &lt;A href="http://www.google.com/search?q=multi+ie&amp;amp;rls=com.microsoft:en-us&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8&amp;amp;startIndex=&amp;amp;startPage=1" mce_href="http://www.google.com/search?q=multi+ie&amp;amp;rls=com.microsoft:en-us&amp;amp;ie=UTF-8&amp;amp;oe=UTF-8&amp;amp;startIndex=&amp;amp;startPage=1"&gt;Multi IE&lt;/A&gt; to install them on the same machine. &lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8994724" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/oanapl/archive/tags/CSS/default.aspx">CSS</category></item></channel></rss>