<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Chris Forbes blogs on SharePoint &#38; .NET &#187; Debugging</title>
	<atom:link href="http://chrisforbesblogs.net/tag/debugging/feed/" rel="self" type="application/rss+xml" />
	<link>http://chrisforbesblogs.net</link>
	<description>Developers chat on SharePoint and .NET</description>
	<lastBuildDate>Tue, 08 May 2012 10:58:45 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='chrisforbesblogs.net' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/3aa4775025bad14a027d0ade34632a33?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Chris Forbes blogs on SharePoint &#38; .NET &#187; Debugging</title>
		<link>http://chrisforbesblogs.net</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://chrisforbesblogs.net/osd.xml" title="Chris Forbes blogs on SharePoint &#38; .NET" />
	<atom:link rel='hub' href='http://chrisforbesblogs.net/?pushpress=hub'/>
		<item>
		<title>Debugging SharePoint</title>
		<link>http://chrisforbesblogs.net/2009/03/01/debugging-sharepoint/</link>
		<comments>http://chrisforbesblogs.net/2009/03/01/debugging-sharepoint/#comments</comments>
		<pubDate>Sun, 01 Mar 2009 18:08:05 +0000</pubDate>
		<dc:creator>Chris Forbes</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[Debugging]]></category>

		<guid isPermaLink="false">http://chrisforbesblogs.wordpress.com/2009/03/01/debugging-sharepoint/</guid>
		<description><![CDATA[One important aspect when developing within SharePoint is obviously how to Debug your code. To begin with you need to disable the friendly, or custom, error messages which has been enabled in SharePoint.&#160; You need to modify the web.config file. Here are the attributes to change… &#60;configuration&#62; &#60;SharePoint&#62; &#60;SafeMode CallStack=&#34;true&#34; /&#62; &#60;/SharePoint&#62; &#60;system.web&#62; &#60;customErrors mode=&#34;Off&#34; [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisforbesblogs.net&#038;blog=6742676&#038;post=17&#038;subd=chrisforbesblogs&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One important aspect when developing within SharePoint is obviously how to Debug your code. </p>
<p>To begin with you need to disable the friendly, or custom, error messages which has been enabled in SharePoint.&#160; You need to modify the web.config file. Here are the attributes to change…</p>
<pre class="code"><span style="color:blue;">&lt;</span><span style="color:#a31515;">configuration</span><span style="color:blue;">&gt;
  &lt;</span><span style="color:#a31515;">SharePoint</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">SafeMode </span><span style="color:red;">CallStack</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">true</span>&quot; <span style="color:blue;">/&gt;
  &lt;/</span><span style="color:#a31515;">SharePoint</span><span style="color:blue;">&gt;

  &lt;</span><span style="color:#a31515;">system.web</span><span style="color:blue;">&gt;
    &lt;</span><span style="color:#a31515;">customErrors </span><span style="color:red;">mode</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">Off</span>&quot; <span style="color:blue;">/&gt;
    &lt;</span><span style="color:#a31515;">compilation </span><span style="color:red;">debug</span><span style="color:blue;">=</span>&quot;<span style="color:blue;">true</span>&quot;
  <span style="color:blue;">&lt;/</span><span style="color:#a31515;">system.web</span><span style="color:blue;">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><strong><u>Local Debugging</u></strong></p>
<p>Remember to change this back when your finished debugging. Occasionally some intentional expectations are thrown to provide information back to the user.&#160; Such as ‘Can’t delete this site as it contains sub sites.’ If you don’t put custom errors back on the user will get an un-friendly stack trace instead.</p>
<p>If, in your development environment you are running SharePoint locally, on the same machine that visual studio has been installed then debugging is fairly easy…</p>
<p>Lets say you have just installed a Feature which has some feature activation code and you wont to step through your code when the feature is activated, before deploying the feature just add a break point at the start of your activation method.</p>
<pre class="code">System.Diagnostics.<span style="color:#2b91af;">Debugger</span>.Break();</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><strong><u>Remote debugging</u></strong></p>
<p>Once you have deployed the feature you will have either deployed the supporting DLL to the GAC (Global Assembly Cache) or in the SharePoints’ site corresponding BIN directory.&#160; If you have the Visual Studio solution running then you wont need to copy any PCB supporting debug files. Just attach to the IIS worker process from Visual Studio and your break point will fire when you activate the feature.</p>
<p>&#160;</p>
<p>If you need to debug your code from a remote server you need to install the Visual Studio remote debugger on the server. Its a little tricky as you need to get your local firewall configured to let&#160; you through, which had me stumped for some time. If its just for a quick debug you could disable your firewall, may save you some headaches, but remember to put it back on again. Check the documentation for setting this up on msdn <a href="http://msdn.microsoft.com/en-us/library/bt727f1t.aspx">http://msdn.microsoft.com/en-us/library/bt727f1t.aspx</a></p>
<p>&#160;</p>
<p>Happy debugging.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chrisforbesblogs.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chrisforbesblogs.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/chrisforbesblogs.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/chrisforbesblogs.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chrisforbesblogs.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chrisforbesblogs.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chrisforbesblogs.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chrisforbesblogs.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chrisforbesblogs.net&#038;blog=6742676&#038;post=17&#038;subd=chrisforbesblogs&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://chrisforbesblogs.net/2009/03/01/debugging-sharepoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/ed3e25ef8a88f8fff819a7722f1805a9?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">chrisforbesblogs</media:title>
		</media:content>
	</item>
	</channel>
</rss>
