<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Code Quality on Marko Apfel</title><link>http://blog.marko-apfel.de/tags/code-quality/</link><description>Recent content in Code Quality on Marko Apfel</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Mon, 07 Nov 2011 22:32:00 +0100</lastBuildDate><atom:link href="http://blog.marko-apfel.de/tags/code-quality/index.xml" rel="self" type="application/rss+xml"/><item><title>Running StyleCop without an installation to empower continuous integration</title><link>http://blog.marko-apfel.de/posts/running-stylecop-without-an-installation-to-empower-continuous-integration/</link><pubDate>Mon, 07 Nov 2011 22:32:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/running-stylecop-without-an-installation-to-empower-continuous-integration/</guid><description>&lt;h2 id="problem"&gt;Problem&lt;/h2&gt;
&lt;p&gt;A continuous integration server should only have a minimal toolset installed. This ensures that no unwanted libraries could affect the build and other steps.&lt;/p&gt;
&lt;p&gt;Clearly that with this slogan also &lt;em&gt;StyleCop&lt;/em&gt; should not be installed to the CI server. But we wanna have this analysis as an part of the whole build.&lt;/p&gt;</description></item><item><title>About trials, spikes, samples, prototypes and clean code</title><link>http://blog.marko-apfel.de/posts/about-trials-spikes-samples-prototypes-and-clean-code/</link><pubDate>Mon, 04 Jul 2011 14:38:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/about-trials-spikes-samples-prototypes-and-clean-code/</guid><description>&lt;p&gt;Writing clean code is only possible if you are known with the uses technology. Often during a development process this level must initially be reached.&lt;/p&gt;
&lt;p&gt;To distinguish the levels of understanding I guess separate folders under the DevTree:&lt;/p&gt;</description></item><item><title>Let ReSharper and Code Contracts work together</title><link>http://blog.marko-apfel.de/posts/let-resharper-and-code-contracts-work-together/</link><pubDate>Sun, 05 Jun 2011 23:55:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/let-resharper-and-code-contracts-work-together/</guid><description>&lt;p&gt;&lt;em&gt;ReSharper&lt;/em&gt; by default does not recognize &lt;code&gt;Contract.Requires&lt;/code&gt; as an annotation hint, that the proofed condition furthermore is &lt;code&gt;true&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;So it comes to the effect, that using the following contract definition causes ReSharper to squiggle the next access and output a wrong hint:&lt;/p&gt;</description></item><item><title>Suppressing FxCop/Code Analysis warnings in Config.Designer.cs of Esri Addins</title><link>http://blog.marko-apfel.de/posts/suppressing-fxcop-code-analysis-warnings-in-config-designer-cs-of-esri-addins/</link><pubDate>Wed, 11 May 2011 13:35:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/suppressing-fxcop-code-analysis-warnings-in-config-designer-cs-of-esri-addins/</guid><description>&lt;p&gt;Addins in ArcGIS Desktop 10 uses tool generated code of the &lt;code&gt;Config.esriaddinx&lt;/code&gt; file.&lt;/p&gt;
&lt;p&gt;Have a look at the properties you will see this tool – named &lt;code&gt;ArcGISAddInHostGenerator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
 &lt;img src="http://blog.marko-apfel.de/posts/suppressing-fxcop-code-analysis-warnings-in-config-designer-cs-of-esri-addins/ConfigEsriaddinx.CustomTool.png" alt="Screenshot for Suppressing FxCop/Code Analysis warnings in Config.Designer.cs of Esri Addins" loading="lazy" decoding="async"&gt;&lt;/figure&gt;&lt;/p&gt;</description></item><item><title>Event Naming Guidelines</title><link>http://blog.marko-apfel.de/posts/event-naming-guidelines/</link><pubDate>Wed, 14 Jul 2010 08:47:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/event-naming-guidelines/</guid><description>&lt;h2 id="rules"&gt;Rules&lt;/h2&gt;
&lt;p&gt;The following rules outline the naming guidelines for events:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Use Pascal case.&lt;/li&gt;
&lt;li&gt;Do not use Hungarian notation.&lt;/li&gt;
&lt;li&gt;Use an EventHandler suffix on event handler names.&lt;/li&gt;
&lt;li&gt;Specify two parameters named sender and e. The sender parameter represents the object that raised the event. The sender parameter is always of type object, even if it is possible to use a more specific type. The state associated with the event is encapsulated in an instance of an event class named e. Use an appropriate and specific event class for the e parameter type.&lt;/li&gt;
&lt;li&gt;Name an event argument class with the EventArgs suffix.&lt;/li&gt;
&lt;li&gt;Consider naming events with a verb. For example, correctly named event names include Clicked, Painting, and DroppedDown.&lt;/li&gt;
&lt;li&gt;Use a gerund (the &amp;ldquo;ing&amp;rdquo; form of a verb) to create an event name that expresses the concept of pre-event, and a past-tense verb to represent post-event. For example, a Close event that can be canceled should have a Closing event and a Closed event. Do not use the BeforeXxx/AfterXxx naming pattern.&lt;/li&gt;
&lt;li&gt;Do not use a prefix or suffix on the event declaration on the type. For example, use Close instead of OnClose.&lt;/li&gt;
&lt;li&gt;In general, you should provide a protected method called OnXxx on types with events that can be overridden in a derived class. This method should only have the event parameter e, because the sender is always the instance of the type.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;from: &lt;a href="http://msdn.microsoft.com/en-us/library/h0eyck3s(VS.71).aspx"&gt;.NET Framework General Reference - Event Naming Guidelines&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Integrate NUnit in Hudson CI-server</title><link>http://blog.marko-apfel.de/posts/integrate-nunit-in-hudson-ci-server/</link><pubDate>Wed, 07 Jul 2010 15:41:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/integrate-nunit-in-hudson-ci-server/</guid><description>&lt;h2 id="precondition"&gt;Precondition&lt;/h2&gt;
&lt;h3 id="naming"&gt;Naming&lt;/h3&gt;
&lt;p&gt;Its a good practice to have a common naming schema for test projects, fixture categories and fixture. Especially to configure automatic runs of unit tests is much more easier with this.&lt;/p&gt;</description></item><item><title>Searching the new FxCop-Release (10.0)</title><link>http://blog.marko-apfel.de/posts/searching-the-new-fxcop-release-10-0/</link><pubDate>Mon, 05 Jul 2010 14:45:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/searching-the-new-fxcop-release-10-0/</guid><description>&lt;p&gt;Today my FxCop-GUI stated, that a new release is available – but the link to this release is broken.&lt;/p&gt;
&lt;p&gt;After googling a little bit i realized, that the new release of FxCop ist actually only included in “Windows SDK for Windows 7.1”.&lt;/p&gt;</description></item><item><title>My own set of SuppressMessage-lines</title><link>http://blog.marko-apfel.de/posts/my-own-set-of-suppressmessage-lines/</link><pubDate>Mon, 05 Jul 2010 10:35:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/my-own-set-of-suppressmessage-lines/</guid><description>&lt;h2 id="stylecop-issues"&gt;StyleCop issues&lt;/h2&gt;
&lt;h3 id="inheritedoc-comment"&gt;inheritedoc-comment&lt;/h3&gt;
&lt;p&gt;Using &lt;!-- raw HTML omitted --&gt;-comment is not recognized by StyleCop. So this needs a suppression:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c1"&gt;// &amp;lt;inheritdoc /&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.StyleCop.CSharp.DocumentationRules&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;SA1604:ElementDocumentationMustHaveSummary&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;InheritDoc&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="fxcop-issues"&gt;FxCop issues&lt;/h2&gt;
&lt;h3 id="too-few-namespaces"&gt;Too few namespaces&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[module: SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Design&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1020:AvoidNamespacesWithFewTypes&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Scope = &amp;#34;namespace&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Target = &amp;#34;EsriDE.Core.Service.Logging&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;We want to have this namespace, but do not have enough classes to go in it right now to satisfy the rule.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="resharper-only-supports-non-static-test-methods"&gt;ReSharper only supports non static test methods&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Performance&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1822:MarkMembersAsStatic&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;ReSharper could not handle static test methods.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="no-strong-name"&gt;No strong name&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[assembly: SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Design&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA2210:AssembliesShouldHaveValidStrongNames&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Strong name is not needed for this.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="catching-general-exception"&gt;Catching general exception&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Design&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1031:DoNotCatchGeneralExceptionTypes&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;We do not know which exceptions could be thrown.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="justification-for-samples-and-fixtures"&gt;Justification for samples and fixtures&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;For fixtures this is OK.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="setter-but-no-getter-for-example-in-ioc-or-nhibernate-context"&gt;Setter but no Getter (for example in IoC or NHibernate-context)&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Usage&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA2227:CollectionPropertiesShouldBeReadOnly&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Setter is needed for nhibernate, otherwise a NHibernate.PropertyNotFoundException will be thrown.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Xyz&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;We only need a setter for setter injection.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="instantiation-with-ioc"&gt;Instantiation with IoC&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Performance&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1811:AvoidUncalledPrivateCode&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;We need this for unit tests.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Performance&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1812:AvoidUninstantiatedInternalClasses&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Class would be instantiated by IoC framework.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="incorrect-naming"&gt;Incorrect naming&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.StyleCop.CSharp.NamingRules&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;SA1310:FieldNamesMustNotContainUnderscore&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Windows message constants are commonly named as WM\_xxxxx&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="incorrect-casing"&gt;Incorrect casing&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[module: SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Naming&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1709:IdentifiersShouldBeCasedCorrectly&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Scope = &amp;#34;type&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Target = &amp;#34;EsriDE.Data.Access.IDbFactory&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; MessageId = &amp;#34;&amp;lt;WrongCasedWord&amp;gt;&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[module: SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Naming&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1709:IdentifiersShouldBeCasedCorrectly&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Scope = &amp;#34;type&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; MessageId = &amp;#34;&amp;lt;WrongCasedWord&amp;gt;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="parametername-should-match-base-declaration"&gt;Parametername should match base declaration&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Naming&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA1725:ParameterNamesShouldMatchBaseDeclaration&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Rule CA1725 has a bug when inspecting parameters from methods from interfaces. So suppress it with class.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="throwing-applicationexception"&gt;Throwing ApplicationException&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.Usage&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CA2201:DoNotRaiseReservedExceptionTypes&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;ApplicationException is OK.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="fxcop-is-too-strict"&gt;FxCop is too strict&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Microsoft.XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;We decide that this is OK.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[module: SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Scope = &amp;#34;resource&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Target = &amp;#34;EsriDE.PipelineManagement.Core.Properties.Messages.resources&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; MessageId = &amp;#34;Toolbar&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;We decide that this is OK.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;This is by design.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="code-from-untaught-colleagues"&gt;Code from untaught colleagues&lt;/h3&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Currently, we do not have enough knowledge or experience to fix this.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt;[SuppressMessage(
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;Microsoft.XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; &amp;#34;CAxyz:XYZ&amp;#34;,
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="na"&gt; Justification = &amp;#34;Cowboy-coding colleagues.&amp;#34;)]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description></item><item><title>Specify a project-specific custom dictionary for FxCop build tasks and Visual Studio Team System static code analysis</title><link>http://blog.marko-apfel.de/posts/specify-a-project-specific-custom-dictionary-for-fxcop-build-tasks-and-visual-studio-team-system-static-code-analysis/</link><pubDate>Fri, 02 Jul 2010 11:27:00 +0200</pubDate><guid>http://blog.marko-apfel.de/posts/specify-a-project-specific-custom-dictionary-for-fxcop-build-tasks-and-visual-studio-team-system-static-code-analysis/</guid><description>&lt;p&gt;Using a project-specific custom dictionary for &lt;em&gt;FxCop&lt;/em&gt; and &lt;em&gt;FxCop build tasks&lt;/em&gt; is very simple. The &lt;em&gt;FxCopCmd&lt;/em&gt; call in the &lt;em&gt;FxCop&lt;/em&gt;-target offers the parameter &lt;code&gt;/dictionary:&amp;lt;DictionaryName&amp;gt;&lt;/code&gt; for that.&lt;/p&gt;
&lt;p&gt;But for &lt;em&gt;Visual Studio&lt;/em&gt; a little bit more steps are needed. And these steps must me gone for all projects.&lt;/p&gt;</description></item><item><title>Visual Studio 2005/2008 Code Analysis Error</title><link>http://blog.marko-apfel.de/posts/visual-studio-2005-2008-code-analysis-error/</link><pubDate>Thu, 26 Nov 2009 12:52:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/visual-studio-2005-2008-code-analysis-error/</guid><description>&lt;p&gt;After installing VS2005 TE on my machine (which previously runs Visual Studio 2008 TE) all mixed projects (VS2005/VS2008 compatibility with TargetFramework=2.0 and ToolsVersion=2.0 options) thrown an error during compilation:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-txt" data-lang="txt"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;C:\Program Files\MSBuild\Microsoft\VisualStudio\v8.0\CodeAnalysis\Microsoft.CodeAnalysis.targets(46,4):
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;error : In order to perform Code Analysis on managed binaries, MSBuild needs to launch FxCop.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;MSBuild is unable to locate the FxCop binaries.
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;Make sure Visual Studio Team Edition for Software Developers or Visual Studio Team Suite is installed
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;and run MSBuild from within the &amp;#34;Visual Studio Command Prompt&amp;#34;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;or specify the path to FxCop by setting the FXCOPDIR environment variable.
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Specifying the &lt;code&gt;FXCOPDIR&lt;/code&gt;-variable brings up the next obscure errors.&lt;/p&gt;</description></item><item><title>StyleCop throws documentation warning SA1600 for private elements</title><link>http://blog.marko-apfel.de/posts/stylecop-throws-documentation-warning-sa1600-for-private-elements/</link><pubDate>Thu, 12 Nov 2009 06:24:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/stylecop-throws-documentation-warning-sa1600-for-private-elements/</guid><description>&lt;p&gt;if you see the following warnings in your code:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
 &lt;img src="http://blog.marko-apfel.de/posts/stylecop-throws-documentation-warning-sa1600-for-private-elements/StyleCop.Warning.SA1600.png" alt="Screenshot for StyleCop throws documentation warning SA1600 for private elements" loading="lazy" decoding="async"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;You have two choices:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;deactivate the rule
but this disables this rule for all documentations – also the wanted&lt;/li&gt;
&lt;li&gt;tune the detail settings
In the settings editor you see additional options if you select the “Documentation Rules” root node&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;figure&gt;
 &lt;img src="http://blog.marko-apfel.de/posts/stylecop-throws-documentation-warning-sa1600-for-private-elements/StyleCop.Settings.01.png" alt="Screenshot for StyleCop throws documentation warning SA1600 for private elements" loading="lazy" decoding="async"&gt;&lt;/figure&gt;&lt;/p&gt;</description></item><item><title>Using a custom dictionary in code analysis</title><link>http://blog.marko-apfel.de/posts/using-a-custom-dictionary-in-code-analysis/</link><pubDate>Wed, 11 Nov 2009 09:22:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/using-a-custom-dictionary-in-code-analysis/</guid><description>&lt;p&gt;see also &lt;a href="http://blog.marko-apfel.de/posts/working-with-microsoft-fxcop/"&gt;Working with Microsoft FxCop&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;As described in the previous post a custom dictionary could be referenced in a FxCop-call of a target by using the option:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cmd" data-lang="cmd"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;/dictionary:&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;quot;$(ProjectDir)..\FxCop.CustomDictionary.xml&lt;span class="p"&gt;&amp;amp;&lt;/span&gt;quot;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;But how is it possible to publish this custom dictionary for the Visual Studio integrated code analysis?&lt;/p&gt;</description></item><item><title>Working with Microsoft FxCop</title><link>http://blog.marko-apfel.de/posts/working-with-microsoft-fxcop/</link><pubDate>Wed, 11 Nov 2009 09:06:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/working-with-microsoft-fxcop/</guid><description>&lt;h2 id="run-fxcop-as-a-post-build-event"&gt;Run FxCop as a post build event&lt;/h2&gt;
&lt;p&gt;Since FxCop 1.36 it is possible to include FxCop in a post-build event.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
 &lt;img src="http://blog.marko-apfel.de/posts/working-with-microsoft-fxcop/developingtools-fxcop-01.png" alt="Screenshot for Working with Microsoft FxCop" loading="lazy" decoding="async"&gt;&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;So FxCop runs after compiling in Visual Studio and allows you directly jumping to the warned line.&lt;/p&gt;</description></item><item><title>Nachtrag: Casting Anti-Pattern</title><link>http://blog.marko-apfel.de/posts/nachtrag-casting-anti-pattern/</link><pubDate>Thu, 29 Oct 2009 12:40:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/nachtrag-casting-anti-pattern/</guid><description>&lt;p&gt;Wie so oft im Leben sind manche Dinge auf den zweiten Blick komplexer als sie auf dem Ersten den Anschein haben.&lt;/p&gt;
&lt;p&gt;Es kam die Anfrage, ob es nicht doch einen Unterschied zwischen &lt;code&gt;as&lt;/code&gt; und &lt;code&gt;is&lt;/code&gt; gibt &amp;amp; dann wurden noch ein paar Inputs gefunden, dass im Falle des &amp;ldquo;Überladens von Cast-Operatoren&amp;rdquo; mögliche Fallen lauern.&lt;/p&gt;</description></item><item><title>Casting Anti-Pattern</title><link>http://blog.marko-apfel.de/posts/casting-anti-pattern/</link><pubDate>Thu, 29 Oct 2009 12:35:00 +0100</pubDate><guid>http://blog.marko-apfel.de/posts/casting-anti-pattern/</guid><description>&lt;p&gt;Im unten stehendem Code ist ein Anti-Pattern, welches immer wieder im ArcObjects-Kontext zu beobachten ist.&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-cs" data-lang="cs"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;element&lt;/span&gt; &lt;span class="k"&gt;is&lt;/span&gt; &lt;span class="n"&gt;IMapSurroundFrame&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="p"&gt;{&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="n"&gt;IMapSurround&lt;/span&gt; &lt;span class="n"&gt;mapSurround&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;IMapSurroundFrame&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="n"&gt;element&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;MapSurround&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="p"&gt;..&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Es wird eine &lt;code&gt;is&lt;/code&gt;-Abfrage gemacht (&lt;code&gt;element is IMapSurroundFrame&lt;/code&gt;) und dann ein Stück später der tatsächliche Cast &lt;code&gt;((IMapSurroundFrame)element)&lt;/code&gt;.&lt;/p&gt;</description></item></channel></rss>