<?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>Developer OneNote &#187; Code Analysis</title>
	<atom:link href="http://devonenote.com/tag/code-analysis/feed/" rel="self" type="application/rss+xml" />
	<link>http://devonenote.com</link>
	<description>Emma&#039;s OneNote for Microsoft Windows, Office and Programming</description>
	<lastBuildDate>Thu, 02 Feb 2012 05:19:49 +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>Find Dead Code</title>
		<link>http://devonenote.com/2010/03/find-dead-code/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-dead-code</link>
		<comments>http://devonenote.com/2010/03/find-dead-code/#comments</comments>
		<pubDate>Sat, 27 Mar 2010 15:04:45 +0000</pubDate>
		<dc:creator>emma</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Tutorial]]></category>
		<category><![CDATA[Code Analysis]]></category>
		<category><![CDATA[Development Resources]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://devonenote.com/2010/03/find-dead-code/</guid>
		<description><![CDATA[Dead code means block of code that is not reachable in application. They can cause noisy in code debugging and confuse developers. Sometimes I might spend a few hours to figure out why a breakpoint never hit. Most of code &#8230; <a href="http://devonenote.com/2010/03/find-dead-code/">Continue reading <span class="meta-nav">&#8594;</span></a>
Related posts:<ol>
<li><a href='http://devonenote.com/2011/03/remove-dead-using-statements/' rel='bookmark' title='Remove dead using statements'>Remove dead using statements</a></li>
<li><a href='http://devonenote.com/2010/04/copysourceashtml-for-visual-studio-2010/' rel='bookmark' title='CopySourceAsHtml for Visual Studio 2010'>CopySourceAsHtml for Visual Studio 2010</a></li>
<li><a href='http://devonenote.com/2010/04/ghostdoc-tutorial/' rel='bookmark' title='GhostDoc Tutorial'>GhostDoc Tutorial</a></li>
<li><a href='http://devonenote.com/2010/05/visual-studio-themes-and-color-schemes/' rel='bookmark' title='Visual Studio Themes and Color Schemes'>Visual Studio Themes and Color Schemes</a></li>
<li><a href='http://devonenote.com/2010/03/visual-studio-plug-in-ghostdoc/' rel='bookmark' title='Visual Studio plug-in: GhostDoc'>Visual Studio plug-in: GhostDoc</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Dead code means block of code that is not reachable in application. They can cause noisy in code debugging and confuse developers. Sometimes I might spend a few hours to figure out why a breakpoint never hit.</p>
<p>Most of code defect is result of old function no longer used and referenced. Remove them will prevent developers from wasting time investigating wrong code. Thanks to FxCop in visual studio, now finding dead code is pretty straight forward.<span id="more-237"></span></p>
<p>1. Open application project and in project properties, click Code Analysis tab. Change Rule Set to Microsoft All Rules as in screenshot.</p>
<p><a href="http://devonenote.com/wp-content/uploads/2010/03/image15.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://devonenote.com/wp-content/uploads/2010/03/image_thumb16.png" border="0" alt="image" width="560" height="378" /></a></p>
<p>2. Click Menu Analyze –&gt; Run Code Analysis</p>
<p><a href="http://devonenote.com/wp-content/uploads/2010/03/image16.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://devonenote.com/wp-content/uploads/2010/03/image_thumb17.png" border="0" alt="image" width="280" height="200" /></a></p>
<p>3. Visual Studio will rebuild projects. FxCop will detect all kind of dead code in build time and report them as following 5 type of warnings. Double click the warning will bring your to the source.</p>
<ul>
<li>Private methods that are not called from any other code (CA1811)</li>
<li>Unused local variables (CA1804)</li>
<li>Unused private fields (CA1823)</li>
<li>Unused parameters (CA1801)</li>
<li>Internal classes that are not instantiated from any other code (CA1812)</li>
</ul>
<p><a href="http://devonenote.com/wp-content/uploads/2010/03/image17.png"><img style="margin: 0px auto; display: block; float: none; border-width: 0px;" title="image" src="http://devonenote.com/wp-content/uploads/2010/03/image_thumb18.png" border="0" alt="image" width="560" height="189" /></a></p>
<p>Now have fun getting dead code removed.</p>
<p>Related posts:<ol>
<li><a href='http://devonenote.com/2011/03/remove-dead-using-statements/' rel='bookmark' title='Remove dead using statements'>Remove dead using statements</a></li>
<li><a href='http://devonenote.com/2010/04/copysourceashtml-for-visual-studio-2010/' rel='bookmark' title='CopySourceAsHtml for Visual Studio 2010'>CopySourceAsHtml for Visual Studio 2010</a></li>
<li><a href='http://devonenote.com/2010/04/ghostdoc-tutorial/' rel='bookmark' title='GhostDoc Tutorial'>GhostDoc Tutorial</a></li>
<li><a href='http://devonenote.com/2010/05/visual-studio-themes-and-color-schemes/' rel='bookmark' title='Visual Studio Themes and Color Schemes'>Visual Studio Themes and Color Schemes</a></li>
<li><a href='http://devonenote.com/2010/03/visual-studio-plug-in-ghostdoc/' rel='bookmark' title='Visual Studio plug-in: GhostDoc'>Visual Studio plug-in: GhostDoc</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://devonenote.com/2010/03/find-dead-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

