<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/atom.xsl" media="screen"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang=""><title type="html">Thomas Lai&amp;#39;s Blog on the CLR and the .NET Framework</title><subtitle type="html" /><id>http://blogs.msdn.com/b/tlai/atom.aspx</id><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/tlai/" /><link rel="self" type="application/atom+xml" href="http://blogs.msdn.com/b/tlai/atom.aspx" /><generator uri="http://telligent.com" version="5.6.50428.7875">Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><updated>2006-06-15T07:41:00Z</updated><entry><title>How to Disable a Specific MDA</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/tlai/archive/2006/06/15/how-to-disable-a-specific-mda.aspx" /><id>http://blogs.msdn.com/b/tlai/archive/2006/06/15/how-to-disable-a-specific-mda.aspx</id><published>2006-06-15T09:46:00Z</published><updated>2006-06-15T09:46:00Z</updated><content type="html">&lt;html&gt;

&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&gt;
&lt;title&gt;How to Disable a Specific MDA&lt;/title&gt;
&lt;style&gt;
&lt;!--
 p.MsoNormal
	{mso-style-parent:"";
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";
	margin-left:0in; margin-right:0in; margin-top:0in}
--&gt;
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p class="MsoNormal"&gt;As Mike Stall has noted in his
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://blogs.msdn.com/jmstall/archive/2006/01/17/pinvoke_100x_slower.aspx"&gt;
post&lt;/a&gt;, the
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://msdn2.microsoft.com/en-us/library/0htdy0k3.aspx"&gt;
PInvokeStackImbalance&lt;/a&gt; MDA can be very slow, depending on the number of 
pinvoke calls in an application.&amp;nbsp; Recently, we have had a few customers running 
into this issue, but
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://msdn2.microsoft.com/en-us/library/d21c150d(VS.80).aspx"&gt;
MSDN&lt;/a&gt; does not give much information regarding disabling MDAs except for 
setting COMPLUS_MDA to 0 or setting the registry key to 0.&amp;nbsp; The problem with 
these options is that they disable all MDAs.&amp;nbsp; Moreover, if you set the registry 
key, it has machine-wide impact.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
There is actually a more fine-grained approach to do this.&amp;nbsp; You can actually 
disable an MDA using an MDA configuration file.&amp;nbsp; However, as mentioned on
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://msdn2.microsoft.com/en-us/library/d21c150d(VS.80).aspx"&gt;
MSDN&lt;/a&gt; and in Stephen Toub’s
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://msdn.microsoft.com/msdnmag/issues/06/05/BugBash/default.aspx"&gt;
article&lt;/a&gt;, the CLR will not look for the MDA configuration file unless either 
the environment variable or the registry key is set 1.&amp;nbsp; Doing so has no effect 
if an application has no MDA configuration file.&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;For example, to disable the PInvokeStackImbalance MDA, you 
can do this:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="text-indent: -.25in; margin-left: .5in"&gt;1)&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Set the COMPLUS_MDA environment variable to 1 (or equivalently, set 
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework\MDA to “1”)&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: .25in"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="text-indent: -.25in; margin-left: .5in"&gt;2)&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; font-size: 7.0pt; font-family: Times New Roman"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Assuming your application is called hello.exe, create 
hello.exe.mda.config in the same directory and put the following XML in it:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;lt;?xml version=&amp;quot;1.0&amp;quot; 
encoding=&amp;quot;UTF-8&amp;quot; ?&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;lt;mdaConfig&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;nbsp; &amp;lt;assistants&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;pInvokeStackImbalance 
enable=&amp;quot;false&amp;quot;/&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;nbsp; &amp;lt;/assistants&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-left: 1.0in"&gt;
&lt;span style="font-size: 9.0pt; font-family: Courier New"&gt;&amp;lt;/mdaConfig&amp;gt;&lt;/span&gt; &lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Note that MDA configuration files have precedence over MDAs 
activated by default for the managed debugger and the unmanaged debugger. &amp;nbsp;This 
means that an MDA configuration file can disable an MDA which is enabled 
automatically because a debugger is attached.&amp;nbsp; (In fact, it is the only way.)&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Due to an oversight, the PInvokeStackImbalance MDA is not 
even defined on 64-bit (both X64 and IA64) platforms.&amp;nbsp; So if you try to use the 
MDA configuration file above on 64-bit platforms, you will get an error.&amp;nbsp; But 
then again, since we only have one calling convention on X64 and one on IA64, 
why would you need this MDA on 64-bit platforms anyway?&amp;nbsp; ;)&amp;nbsp;&amp;nbsp; &lt;/p&gt;

&lt;/body&gt;

&lt;/html&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=631954" width="1" height="1"&gt;</content><author><name>tlai</name><uri>http://blogs.msdn.com/tlai/ProfileUrlRedirect.ashx</uri></author><category term="MDA" scheme="http://blogs.msdn.com/b/tlai/archive/tags/MDA/" /></entry><entry><title>Introduction</title><link rel="alternate" type="text/html" href="http://blogs.msdn.com/b/tlai/archive/2006/06/15/introduction.aspx" /><id>http://blogs.msdn.com/b/tlai/archive/2006/06/15/introduction.aspx</id><published>2006-06-15T09:41:00Z</published><updated>2006-06-15T09:41:00Z</updated><content type="html">&lt;html&gt;

&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=windows-1252"&gt;
&lt;title&gt;Introduction&lt;/title&gt;
&lt;style&gt;
&lt;!--
 p.MsoNormal
	{mso-style-parent:"";
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";
	margin-left:0in; margin-right:0in; margin-top:0in}
--&gt;
&lt;/style&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;p class="MsoNormal"&gt;Hi everyone, my name is Thomas Lai. &amp;nbsp;I am a developer on 
the
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://msdn.microsoft.com/netframework/programming/clr/default.aspx"&gt;
Common Language Runtime&lt;/a&gt; (CLR) team at Microsoft. &amp;nbsp;More specifically, I am on 
the Developer Services Team, which includes both the Profiling Services Team and 
the Debugging Services Team.&amp;nbsp; Prior to Whidbey RTM, I worked on the CLR Port 
Team, porting the CLR to both X64 and IA64.&amp;nbsp; Needless to say, I’m biased against 
the x86 platform.&amp;nbsp; So don’t be surprised when you hear me bash the “legacy” x86 
platform from time to time. &amp;nbsp;:)&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;I am a late comer to the blogging world. &amp;nbsp;Quite a few of my 
current and former colleagues already have their own blogs:
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://blogs.msdn.com/jmstall/"&gt;
Mike Stall&lt;/a&gt;,
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://blogs.msdn.com/rmbyers/"&gt;
Rick Byers&lt;/a&gt;,
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://blogs.msdn.com/davbr/"&gt;
David Broman&lt;/a&gt;,
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://blogs.msdn.com/joshwil/"&gt;
Josh Williams&lt;/a&gt;, etc.&amp;nbsp; Since there is already a good coverage of various CLR 
topics, I have not found any specific hole I can fill with my blog yet.&amp;nbsp; I will 
write about anything I find interesting/obscure/ridiculous. &amp;nbsp;Of course, my 
entries will be mostly related to my daily work, i.e. managed debugging, 64-bit, 
etc.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;One area I have picked up recently is the infrastructure 
for the
&lt;a style="color: blue; text-decoration: underline; text-underline: single" href="http://msdn2.microsoft.com/en-us/library/d21c150d(vs.80).aspx"&gt;
Managed Debugging Assistants&lt;/a&gt; (MDAs). &amp;nbsp;My first blog will be on how to 
disable a specific MDA. &amp;nbsp;Stay tuned if you are interested.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&amp;nbsp;&lt;/p&gt;

&lt;/body&gt;

&lt;/html&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=631948" width="1" height="1"&gt;</content><author><name>tlai</name><uri>http://blogs.msdn.com/tlai/ProfileUrlRedirect.ashx</uri></author><category term="Misc" scheme="http://blogs.msdn.com/b/tlai/archive/tags/Misc/" /></entry></feed>