<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Rohland de Charmoy &#187; debugging</title>
	<atom:link href="http://www.rohland.co.za/index.php/tag/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rohland.co.za</link>
	<description>Pushing buttons...</description>
	<lastBuildDate>Sat, 04 Feb 2012 16:01:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Maintain debug information while in release mode</title>
		<link>http://www.rohland.co.za/index.php/2009/02/11/maintain-debug-information-while-in-release-mode/</link>
		<comments>http://www.rohland.co.za/index.php/2009/02/11/maintain-debug-information-while-in-release-mode/#comments</comments>
		<pubDate>Wed, 11 Feb 2009 13:04:45 +0000</pubDate>
		<dc:creator>Rohland</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://www.rohland.co.za/?p=13</guid>
		<description><![CDATA[If you have every deployed a website / web application, you would most probably have included some kind of logging mechanism that records any exceptions that occur at runtime. In my case, I like to include a global exception catcher in my apps so that I get notified if a user receives any kind of [...]]]></description>
			<content:encoded><![CDATA[<p><P>If you have every deployed a website / web application, you would most probably have included some kind of logging mechanism that records any exceptions that occur at runtime. In my case, I like to include a global exception catcher in my apps so that I get notified if a user receives any kind of uncaught exception. The main problem with this approach is that if the application is compiled in release mode you normally would not be able to get an exact handle on the line of code that caused the exception. The trace is still useful but would be much more valuable if the line numbers were included.</P></p>
<p><P>Well, this is possible even when your app is running in release mode. Simply update your web.config as follows (note the highlighted compilerOptions tag):</P></p>
<p><DIV class="code" style="FONT-FAMILY: consolas; BACKGROUND: black; COLOR: white; FONT-SIZE: 10pt; FONT-WEIGHT: bold"><br />
<P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 141</SPAN> &lt;<SPAN style="COLOR: #cc7832">system.codedom</SPAN>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 142</SPAN>&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">compilers</SPAN>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 143</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">compiler</SPAN> language=&#8221;<SPAN style="COLOR: #a5c25c">c#;cs;csharp</SPAN>&#8221; extension=&#8221;<SPAN style="COLOR: #a5c25c">.cs</SPAN>&#8221; warningLevel=&#8221;<SPAN style="COLOR: #a5c25c">4</SPAN>&#8221; type=&#8221;<SPAN style="COLOR: #a5c25c">Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c</SPAN><SPAN style="COLOR: #a5c25c">561934e089</SPAN>&#8221; <FONT color=#ffff00>compilerOptions=&#8221;<SPAN style="COLOR: #a5c25c">/<FONT color=#ffff00>debug:pdbonly</FONT></SPAN>&#8220;</FONT>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 144</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">providerOption</SPAN> name=&#8221;<SPAN style="COLOR: #a5c25c">CompilerVersion</SPAN>&#8221; value=&#8221;<SPAN style="COLOR: #a5c25c">v3.5</SPAN>&#8220;/&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 145</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">providerOption</SPAN> name=&#8221;<SPAN style="COLOR: #a5c25c">WarnAsError</SPAN>&#8221; value=&#8221;<SPAN style="COLOR: #a5c25c">false</SPAN>&#8220;/&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 146</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<SPAN style="COLOR: #cc7832">compiler</SPAN>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 147</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">compiler</SPAN> language=&#8221;<SPAN style="COLOR: #a5c25c">vb;vbs;visualbasic;vbscript</SPAN>&#8221; extension=&#8221;<SPAN style="COLOR: #a5c25c">.vb</SPAN>&#8221; warningLevel=&#8221;<SPAN style="COLOR: #a5c25c">4</SPAN>&#8221; type=&#8221;<SPAN style="COLOR: #a5c25c">Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5</SPAN><SPAN style="COLOR: #a5c25c">c561934e089</SPAN>&#8221; <FONT color=#ffff00>compilerOptions=&#8221;<SPAN style="COLOR: #a5c25c">/<FONT color=#ffff00>debug:pdbonly</FONT></SPAN>&#8220;</FONT>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 148</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">providerOption</SPAN> name=&#8221;<SPAN style="COLOR: #a5c25c">CompilerVersion</SPAN>&#8221; value=&#8221;<SPAN style="COLOR: #a5c25c">v3.5</SPAN>&#8220;/&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 149</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">providerOption</SPAN> name=&#8221;<SPAN style="COLOR: #a5c25c">OptionInfer</SPAN>&#8221; value=&#8221;<SPAN style="COLOR: #a5c25c">true</SPAN>&#8220;/&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 150</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;<SPAN style="COLOR: #cc7832">providerOption</SPAN> name=&#8221;<SPAN style="COLOR: #a5c25c">WarnAsError</SPAN>&#8221; value=&#8221;<SPAN style="COLOR: #a5c25c">false</SPAN>&#8220;/&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 151</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<SPAN style="COLOR: #cc7832">compiler</SPAN>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 152</SPAN>&nbsp;&nbsp;&nbsp;&nbsp; &lt;/<SPAN style="COLOR: #cc7832">compilers</SPAN>&gt;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp; 153</SPAN> &lt;/<SPAN style="COLOR: #cc7832">system.codedom</SPAN>&gt;</P><br />
</DIV><br />
<P>For more information about emitting debug information follow this link: <A title=http://msdn.microsoft.com/en-us/library/8cw0bt21(VS.80).aspx href="http://msdn.microsoft.com/en-us/library/8cw0bt21(VS.80).aspx" mce_href="http://msdn.microsoft.com/en-us/library/8cw0bt21(VS.80).aspx">http://msdn.microsoft.com/en-us/library/8cw0bt21(VS.80).aspx</A></P></p>
<p><P>Hope this helps.</P></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rohland.co.za/index.php/2009/02/11/maintain-debug-information-while-in-release-mode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Logging trace output</title>
		<link>http://www.rohland.co.za/index.php/2009/01/30/logging-trace-output/</link>
		<comments>http://www.rohland.co.za/index.php/2009/01/30/logging-trace-output/#comments</comments>
		<pubDate>Fri, 30 Jan 2009 08:16:27 +0000</pubDate>
		<dc:creator>Rohland</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[debugging]]></category>

		<guid isPermaLink="false">http://www.rohland.co.za/?p=9</guid>
		<description><![CDATA[I was recently testing out a third party tool and wanted to log some of the trace information, here is how you do it: * Note that in this example, the trace is simply being sent to the console, but you could write it to a file / database &#8230; &#160;&#160;&#160; 1&#160;// Place the code [...]]]></description>
			<content:encoded><![CDATA[<p><P>I was recently testing out a third party tool and wanted to log some of the trace information, here is how you do it:</P></p>
<p><P>* Note that in this example, the trace is simply being sent to the console, but you could write it to a file / database &#8230;</P></p>
<p><DIV class="code" style="FONT-FAMILY: consolas; BACKGROUND: black; COLOR: white; FONT-SIZE: 10pt; FONT-WEIGHT: bold"><br />
<P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 1</SPAN>&nbsp;<SPAN style="COLOR: gray">// Place the code below at the beginning of your execution context</SPAN></P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 2</SPAN>&nbsp;<SPAN style="COLOR: #ffc66d">StringBuilder</SPAN> builder = <SPAN style="COLOR: #cc7832">new</SPAN> <SPAN style="COLOR: #ffc66d">StringBuilder</SPAN>();</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 3</SPAN>&nbsp;<SPAN style="COLOR: #ffc66d">TextWriter</SPAN> writer = <SPAN style="COLOR: #cc7832">new</SPAN> <SPAN style="COLOR: #ffc66d">StringWriter</SPAN>(builder);</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 4</SPAN>&nbsp;<SPAN style="COLOR: #ffc66d">TextWriterTraceListener</SPAN> listner = <SPAN style="COLOR: #cc7832">new</SPAN> <SPAN style="COLOR: #ffc66d">TextWriterTraceListener</SPAN>(writer);</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 5</SPAN>&nbsp;<SPAN style="COLOR: #ffc66d">Trace</SPAN><SPAN style="FONT-WEIGHT: normal">.Listeners.Add(listner);</SPAN></P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 6</SPAN>&nbsp;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 7</SPAN>&nbsp;<SPAN style="COLOR: gray">// Then do something here</SPAN></P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 8</SPAN>&nbsp;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp;&nbsp; 9</SPAN>&nbsp;</P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp; 10</SPAN>&nbsp;<SPAN style="COLOR: gray">// Place the code below at the end of your execution context to log to file / database / console &#8230;</SPAN></P></p>
<p><P style="MARGIN: 0px"><SPAN style="COLOR: #2b91af; FONT-WEIGHT: normal">&nbsp;&nbsp; 11</SPAN>&nbsp;<SPAN style="COLOR: #ffc66d">Console</SPAN><SPAN style="FONT-WEIGHT: normal">.Write(builder.ToString());</SPAN></P><br />
</DIV><BR><BR></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rohland.co.za/index.php/2009/01/30/logging-trace-output/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

