<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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: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>Comments for VSX Experience</title>
	<atom:link href="http://vsxexperience.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://vsxexperience.net</link>
	<description>A Developer Experience with Visual Studio Extensibility</description>
	<lastBuildDate>Fri, 30 Sep 2011 09:09:54 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-65</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Fri, 30 Sep 2011 09:09:54 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-65</guid>
		<description><![CDATA[&lt;blockquote cite=&quot;#commentbody-63&quot;&gt;
&lt;strong&gt;&lt;a href=&quot;#comment-63&quot; rel=&quot;nofollow&quot;&gt;Jan Kinable&lt;/a&gt; :&lt;/strong&gt;
Hey Steve,
I finally found some time to look into your contribution. It’s a pitty but I will not incorporate your solution and this for the very simple reason that it has too much dependencies to third party assemblies. NRefactory -&gt; mono.cecil and to be able to build this I must install NUnit. I notice that you are favorit to open source software. I don’t hold anything against it but when you want to build a package you want to prevent including to much assemblies. If every contributor would port their 3th party assembly, sooner or later you will end-up with a version clash. I like clean solutions, thus only the tools VS/MS offers.
&lt;/blockquote&gt;
Not a problem. I share your opinion for the most part. When I get some free time I am planning on refactoring NRefactory out for the reasons you specify.

Also, thanks for the tip about the SComponentModel service, I completely missed that!]]></description>
		<content:encoded><![CDATA[<blockquote cite="#commentbody-63"><p>
<strong><a href="#comment-63" rel="nofollow">Jan Kinable</a> :</strong><br />
Hey Steve,<br />
I finally found some time to look into your contribution. It’s a pitty but I will not incorporate your solution and this for the very simple reason that it has too much dependencies to third party assemblies. NRefactory -&gt; mono.cecil and to be able to build this I must install NUnit. I notice that you are favorit to open source software. I don’t hold anything against it but when you want to build a package you want to prevent including to much assemblies. If every contributor would port their 3th party assembly, sooner or later you will end-up with a version clash. I like clean solutions, thus only the tools VS/MS offers.
</p></blockquote>
<p>Not a problem. I share your opinion for the most part. When I get some free time I am planning on refactoring NRefactory out for the reasons you specify.</p>
<p>Also, thanks for the tip about the SComponentModel service, I completely missed that!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Jan Kinable</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-64</link>
		<dc:creator><![CDATA[Jan Kinable]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 12:25:32 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-64</guid>
		<description><![CDATA[Hey Steve,

I do use this feature but you are forgetting there is already a container created by VS. You can get to it by resolving the IComponentModel through the ServiceProvider:
&lt;code&gt;IComponentModel componentModel = GetService(typeof(SComponentModel)) as IComponentModel;&lt;/code&gt;

Then you can create your DirectoryCatalog and aggregate it with the existing one:
&lt;code&gt;DirectoryCatalog directoryCatalog = ...;
AggregateCatalog = new AggregateCatelog(componentModel.DefaultCatalog, directoryCatalog);&lt;/code&gt;

You have to make use of a CompositionBatch (allows you to dynamically add/remove parts):
&lt;code&gt;CompositionBatch compositionBatch = new CompositionBatch();
CompositionContainer container = new CompositionContainer(aggregateCatalog);
container.Compose(compositionBatch);&lt;/code&gt;
And your done.]]></description>
		<content:encoded><![CDATA[<p>Hey Steve,</p>
<p>I do use this feature but you are forgetting there is already a container created by VS. You can get to it by resolving the IComponentModel through the ServiceProvider:<br />
<code>IComponentModel componentModel = GetService(typeof(SComponentModel)) as IComponentModel;</code></p>
<p>Then you can create your DirectoryCatalog and aggregate it with the existing one:<br />
<code>DirectoryCatalog directoryCatalog = ...;<br />
AggregateCatalog = new AggregateCatelog(componentModel.DefaultCatalog, directoryCatalog);</code></p>
<p>You have to make use of a CompositionBatch (allows you to dynamically add/remove parts):<br />
<code>CompositionBatch compositionBatch = new CompositionBatch();<br />
CompositionContainer container = new CompositionContainer(aggregateCatalog);<br />
container.Compose(compositionBatch);</code><br />
And your done.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Jan Kinable</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-63</link>
		<dc:creator><![CDATA[Jan Kinable]]></dc:creator>
		<pubDate>Fri, 23 Sep 2011 11:45:49 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-63</guid>
		<description><![CDATA[Hey Steve, 
I finally found some time to look into your contribution. It&#039;s a pitty but I will not incorporate your solution and this for the very simple reason that it has too much dependencies to third party assemblies. NRefactory -&gt; mono.cecil and to be able to build this I must install NUnit. I notice that you are favorit to open source software. I don&#039;t hold anything against it but when you want to build a package you want to prevent including to much assemblies. If every contributor would port their 3th party assembly, sooner or later you will end-up with a version clash. I like clean solutions, thus only the tools VS/MS offers.]]></description>
		<content:encoded><![CDATA[<p>Hey Steve,<br />
I finally found some time to look into your contribution. It&#8217;s a pitty but I will not incorporate your solution and this for the very simple reason that it has too much dependencies to third party assemblies. NRefactory -&gt; mono.cecil and to be able to build this I must install NUnit. I notice that you are favorit to open source software. I don&#8217;t hold anything against it but when you want to build a package you want to prevent including to much assemblies. If every contributor would port their 3th party assembly, sooner or later you will end-up with a version clash. I like clean solutions, thus only the tools VS/MS offers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-62</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 21 Sep 2011 15:40:57 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-62</guid>
		<description><![CDATA[Hi Jan,

Me again! I have been working on the extensibility side of this add-in now. I have found that if you change the ComposeContainer method to;

        AggregateCatalog cat = new AggregateCatalog();
        CompositionContainer _container;

        protected void ComposeContainer()
        {
            FileInfo assembly = new FileInfo(Assembly.GetExecutingAssembly().Location);

            this.cat.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            this.cat.Catalogs.Add(new DirectoryCatalog(assembly.Directory + &quot;\\extensions&quot;));  
            
            _container = new CompositionContainer(this.cat);

            //Fill the imports of this object
            try
            {
                this._container.ComposeParts(this);
            }
            catch (CompositionException compositionException)
            {
                Console.WriteLine(compositionException.ToString());
            }
        }

Then you can drop assemblies into the extensions sub-folder without having to register them as MEF components. It works equally well with your suggested &quot;C:\FxCopExtensions&quot; too.

Hope you find this useful.

Steve]]></description>
		<content:encoded><![CDATA[<p>Hi Jan,</p>
<p>Me again! I have been working on the extensibility side of this add-in now. I have found that if you change the ComposeContainer method to;</p>
<p>        AggregateCatalog cat = new AggregateCatalog();<br />
        CompositionContainer _container;</p>
<p>        protected void ComposeContainer()<br />
        {<br />
            FileInfo assembly = new FileInfo(Assembly.GetExecutingAssembly().Location);</p>
<p>            this.cat.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));<br />
            this.cat.Catalogs.Add(new DirectoryCatalog(assembly.Directory + &#8220;\\extensions&#8221;));  </p>
<p>            _container = new CompositionContainer(this.cat);</p>
<p>            //Fill the imports of this object<br />
            try<br />
            {<br />
                this._container.ComposeParts(this);<br />
            }<br />
            catch (CompositionException compositionException)<br />
            {<br />
                Console.WriteLine(compositionException.ToString());<br />
            }<br />
        }</p>
<p>Then you can drop assemblies into the extensions sub-folder without having to register them as MEF components. It works equally well with your suggested &#8220;C:\FxCopExtensions&#8221; too.</p>
<p>Hope you find this useful.</p>
<p>Steve</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-61</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 10:50:50 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-61</guid>
		<description><![CDATA[Sorry about the huge post! Finally, the usage;

                var variableDeclarations =
                    parser.CompilationUnit.Children
                    .FindMethods(x =&gt; x.Children, methodName)
                    .FindLocalVariables(x =&gt; x.Children, variableName)
                    .OrderByDescending(x =&gt; x.StartLocation.Line)
                    .ToList();

The above statement finds a specified variable within the specified method name. I then use the list within a for loop as below;

                foreach (var localVariableDeclaration in variableDeclarations)
                {
                    INode parentNode = localVariableDeclaration.Parent;
                    
                    if (parentNode is BlockStatement &amp;&amp; parentNode.StartLocation.Line = lineNumber)
                    {
                        IdentifierExpression identifierExpression = new IdentifierExpression(variableName);
                        MemberReferenceExpression memberReferenceExpression = new MemberReferenceExpression(identifierExpression, &quot;Dispose&quot;);
                        InvocationExpression invocationExpression = new InvocationExpression(memberReferenceExpression);
                        
                        ExpressionStatement expressionStatement = new ExpressionStatement(invocationExpression);

                        INode insertBefore = this.GetInsertionStatement(parentNode, localVariableDeclaration.StartLocation.Line);

                        if (insertBefore == null) 
                        {
                            parentNode.Children.Add(expressionStatement);
                        }
                        else
                        {
                            parentNode.Children.Insert(parentNode.Children.IndexOf(insertBefore), expressionStatement);
                        }

                        this.FixedLineNumber = parentNode.EndLocation.Line;
                        this.FixedColumnNumber = parentNode.EndLocation.Column;
                    }
                }

This particular example adds a call to Dispose into the code for the variable specified in variableName.

Hope that all makes sense!]]></description>
		<content:encoded><![CDATA[<p>Sorry about the huge post! Finally, the usage;</p>
<p>                var variableDeclarations =<br />
                    parser.CompilationUnit.Children<br />
                    .FindMethods(x =&gt; x.Children, methodName)<br />
                    .FindLocalVariables(x =&gt; x.Children, variableName)<br />
                    .OrderByDescending(x =&gt; x.StartLocation.Line)<br />
                    .ToList();</p>
<p>The above statement finds a specified variable within the specified method name. I then use the list within a for loop as below;</p>
<p>                foreach (var localVariableDeclaration in variableDeclarations)<br />
                {<br />
                    INode parentNode = localVariableDeclaration.Parent;</p>
<p>                    if (parentNode is BlockStatement &amp;&amp; parentNode.StartLocation.Line = lineNumber)<br />
                    {<br />
                        IdentifierExpression identifierExpression = new IdentifierExpression(variableName);<br />
                        MemberReferenceExpression memberReferenceExpression = new MemberReferenceExpression(identifierExpression, &#8220;Dispose&#8221;);<br />
                        InvocationExpression invocationExpression = new InvocationExpression(memberReferenceExpression);</p>
<p>                        ExpressionStatement expressionStatement = new ExpressionStatement(invocationExpression);</p>
<p>                        INode insertBefore = this.GetInsertionStatement(parentNode, localVariableDeclaration.StartLocation.Line);</p>
<p>                        if (insertBefore == null)<br />
                        {<br />
                            parentNode.Children.Add(expressionStatement);<br />
                        }<br />
                        else<br />
                        {<br />
                            parentNode.Children.Insert(parentNode.Children.IndexOf(insertBefore), expressionStatement);<br />
                        }</p>
<p>                        this.FixedLineNumber = parentNode.EndLocation.Line;<br />
                        this.FixedColumnNumber = parentNode.EndLocation.Column;<br />
                    }<br />
                }</p>
<p>This particular example adds a call to Dispose into the code for the variable specified in variableName.</p>
<p>Hope that all makes sense!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-60</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 10:46:14 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-60</guid>
		<description><![CDATA[// --------------------------------------------------------------------------------------------------------------------
// 
//   
// 
// 
//   Extension methods to facilitate code parsing using LINQ &amp; NRefactory
// 
// --------------------------------------------------------------------------------------------------------------------
namespace Rules.FixesLib
{
    using System;
    using System.Collections.Generic;
    using System.Linq;

    using ICSharpCode.NRefactory.Ast;
    
    /// 
    /// Extension methods for processing an enumeration if INode
    /// 
    public static class CodeParsingExtensions
    {
        /// 
        /// The search criteria specified for a string literal search - Only used by FindStringLiteral
        /// 
        private static string stringliteralSearchCriteria = string.Empty;

        /// 
        /// The INodes matching the search criteria - Only used by FindStringLiteral 
        /// 
        private static List searchMatches = null;

        /// 
        /// Finds the local variables with the specified variable name
        /// 
        /// The source enumeration
        /// Delegate used when searching.
        /// Name of the variable to locate.
        /// IEnumerable containing INode that have the specified variable name (case sensitive)
        public static IEnumerable FindLocalVariables(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate, string variableName)
        {
            return source.Traverse(x =&gt; x.Children)
                .Where(x =&gt; x is LocalVariableDeclaration).Cast()
                .Where(x =&gt; x.GetVariableDeclaration(variableName) != null);
        }

        /// 
        /// Finds the methods with the specified name
        /// 
        /// The source enumeration to search
        /// Delegate used when searching.
        /// Name of the method (case sensitive)
        /// IEnumerable containing INode that have the specified method name
        public static IEnumerable FindMethods(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate, string methodName)
        {
            return source.Traverse(x =&gt; x.Children)
                .Where(x =&gt; x is MethodDeclaration).Cast()
                .Where(x =&gt; x.Name == methodName);
        }

        /// 
        /// Finds the string literal
        /// 
        /// The source enumeration to search
        /// Delegate used when searching.
        /// Content of the literal (case sensitive)
        /// IEnumerable of parent INodes containing the string literal.
        public static IEnumerable FindStringLiteral(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate, string literalContent)
        {
            stringliteralSearchCriteria = literalContent;

            // populated when expressions are evaluated
            searchMatches = new List();

            source.Traverse(x =&gt; x.Children).Where(x =&gt; x is ExpressionStatement).ToList();

            return searchMatches;
        }

        /// 
        /// Evaluates an expression and all nested expressions 
        /// 
        /// The source enumeration
        /// INode containing an expression
        /// This is fairly ugly. In this instance the EvaluateExpression function is used only to support the FindStringLiteral method. It could be extended for more search methods if required.
        private static INode EvaluateExpression(Expression source)
        {
            ////ICSharpCode.NRefactory.Ast.QueryExpressionVB - unsupported right now

            if (source is AddressOfExpression)
            {
                AddressOfExpression a = source as AddressOfExpression;
                return EvaluateExpression(a.Expression);
            }
            else if (source is AnonymousMethodExpression)
            {
                AnonymousMethodExpression a = source as AnonymousMethodExpression;
                foreach (Expression parameterExpression in a.Parameters)
                {
                    if (null != EvaluateExpression(parameterExpression))
                    {
                        return a.Parent;
                    }
                }
            }
            else if (source is ArrayCreateExpression)
            {
                ArrayCreateExpression a = source as ArrayCreateExpression;

                if (null != EvaluateExpression(a.ArrayInitializer))
                {
                    return a.Parent;
                }

                foreach (Expression argumentExpression in a.Arguments)
                {
                    if (null != EvaluateExpression(argumentExpression))
                    {
                        return a.Parent;
                    }
                }
            }
            else if (source is AssignmentExpression)
            {
                AssignmentExpression a = source as AssignmentExpression;

                if (null != EvaluateExpression(a.Left))
                {
                    return a.Parent;
                }

                if (null != EvaluateExpression(a.Right))
                {
                    return a.Parent;
                }
            }
            else if (source is BinaryOperatorExpression)
            {
                BinaryOperatorExpression b = source as BinaryOperatorExpression;

                if (null != EvaluateExpression(b.Left))
                {
                    return b.Parent;
                }

                if (null != EvaluateExpression(b.Right))
                {
                    return b.Parent;
                }
            }
            else if (source is CastExpression)
            {
                CastExpression c = source as CastExpression;

                if (null != EvaluateExpression(c.Expression))
                {
                    return c.Parent;
                }
            }
            else if (source is CheckedExpression)
            {
                CheckedExpression c = source as CheckedExpression;
                if (null != EvaluateExpression(c.Expression))
                {
                    return c.Parent;
                }
            }
            else if (source is CollectionInitializerExpression)
            {
                CollectionInitializerExpression c = source as CollectionInitializerExpression;
                foreach (Expression createExpression in c.CreateExpressions)
                {
                    if (null != EvaluateExpression(createExpression))
                    {
                        return c.Parent;
                    }
                }
            }
            else if (source is ConditionalExpression)
            {
                ConditionalExpression c = source as ConditionalExpression;

                if (null != EvaluateExpression(c.Condition))
                {
                    return c.Parent;
                }

                if (null != EvaluateExpression(c.TrueExpression))
                {
                    return c.Parent;
                }

                if (null != EvaluateExpression(c.FalseExpression))
                {
                    return c.Parent;
                }
            }
            else if (source is DirectionExpression)
            {
                DirectionExpression d = source as DirectionExpression;
                if (null != EvaluateExpression(d.Expression))
                {
                    return d.Parent;
                }
            }
            else if (source is InvocationExpression)
            {
                InvocationExpression i = source as InvocationExpression;

                if (null != EvaluateExpression(i.TargetObject))
                {
                    return i.Parent;
                }

                foreach (Expression argumentExpression in i.Arguments)
                {
                    if (null != EvaluateExpression(argumentExpression))
                    {
                        return i.Parent;
                    }
                }
            }
            else if (source is IdentifierExpression)
            {
                IdentifierExpression id = source as IdentifierExpression;
            }
            else if (source is IndexerExpression)
            {
                IndexerExpression id = source as IndexerExpression;
                foreach (Expression indexExpression in id.Indexes)
                {
                    if (null != EvaluateExpression(indexExpression))
                    {
                        return id.Parent;
                    }
                }
            }
            else if (source is LambdaExpression)
            {
                LambdaExpression l = source as LambdaExpression;
                if (null != EvaluateExpression(l.ExpressionBody))
                {
                    return l.Parent;
                }
            }
            else if (source is MemberInitializerExpression)
            {
                MemberInitializerExpression m = source as MemberInitializerExpression;
                if (null != EvaluateExpression(m.Expression))
                {
                    return m.Parent;
                }
            }
            else if (source is MemberReferenceExpression)
            {
                MemberReferenceExpression m = source as MemberReferenceExpression;
                if (null != EvaluateExpression(m.TargetObject))
                {
                    return m.Parent;
                }
            }
            else if (source is NamedArgumentExpression)
            {
                NamedArgumentExpression n = source as NamedArgumentExpression;
                if (null != EvaluateExpression(n.Expression))
                {
                    return n.Parent;
                }
            }
            else if (source is ObjectCreateExpression)
            {
                ObjectCreateExpression obj = source as ObjectCreateExpression;
                if (null != EvaluateExpression(obj.ObjectInitializer))
                {
                    return obj.Parent;
                }

                foreach (Expression parameterExpression in obj.Parameters)
                {
                    if (null != EvaluateExpression(parameterExpression))
                    {
                        return obj.Parent;
                    }
                }
            }
            else if (source is ParameterDeclarationExpression)
            {
                ParameterDeclarationExpression p = source as ParameterDeclarationExpression;

                if (null != EvaluateExpression(p.DefaultValue))
                {
                    return p.Parent;
                }
            }
            else if (source is ParenthesizedExpression)
            {
                ParenthesizedExpression p = source as ParenthesizedExpression;
                if (null != EvaluateExpression(p.Expression))
                {
                    return p.Parent;
                }
            }
            else if (source is PrimitiveExpression)
            {
                PrimitiveExpression p = source as PrimitiveExpression;

                if (p.StringValue == string.Format(&quot;\&quot;{0}\&quot;&quot;, stringliteralSearchCriteria))
                {
                    searchMatches.Add(p.Parent);
                    return p.Parent;
                }
            }
            else if (source is TypeOfIsExpression)
            {
                TypeOfIsExpression t = source as TypeOfIsExpression;
                if (null != EvaluateExpression(t.Expression))
                {
                    return t.Parent;
                }
            }
            else if (source is UnaryOperatorExpression)
            {
                UnaryOperatorExpression u = source as UnaryOperatorExpression;
                if (null != EvaluateExpression(u.Expression))
                {
                    return u.Parent;
                }
            }
            else if (source is UncheckedExpression)
            {
                UncheckedExpression u = source as UncheckedExpression;
                if (null != EvaluateExpression(u.Expression))
                {
                    return u.Parent;
                }
            }
            else if (source is XmlAttributeExpression)
            {
                XmlAttributeExpression x = source as XmlAttributeExpression;
                if (null != EvaluateExpression(x.ExpressionValue))
                {
                    return x.Parent;
                }
            }
            else if (source is XmlContentExpression)
            {
                XmlContentExpression x = source as XmlContentExpression;
            }
            else if (source is XmlDocumentExpression)
            {
                XmlDocumentExpression x = source as XmlDocumentExpression;
                foreach (XmlExpression xmlExpression in x.Expressions)
                {
                    if (null != EvaluateExpression(xmlExpression))
                    {
                        return x.Parent;
                    }
                }
            }
            else if (source is XmlElementExpression)
            {
                XmlElementExpression x = source as XmlElementExpression;
                if (null != EvaluateExpression(x.Content))
                {
                    return x.Parent;
                }

                if (null != EvaluateExpression(x.NameExpression))
                {
                    return x.Parent;
                }
            }
            else if (source is XmlEmbeddedExpression)
            {
                XmlEmbeddedExpression x = source as XmlEmbeddedExpression;
                if (null != EvaluateExpression(x.InlineVBExpression))
                {
                    return x.Parent;
                }
            }
            else if (source is XmlMemberAccessExpression)
            {
                XmlMemberAccessExpression x = source as XmlMemberAccessExpression;
                if (null != EvaluateExpression(x.TargetObject))
                {
                    return x.Parent;
                }
            }
            else if (source is BaseReferenceExpression &#124;&#124; source is ClassReferenceExpression &#124;&#124;
                     source is DefaultValueExpression &#124;&#124; source is QueryExpression &#124;&#124; source is TypeOfExpression &#124;&#124;
                     source is TypeReferenceExpression &#124;&#124; source is ThisReferenceExpression &#124;&#124;
                     source is SizeOfExpression &#124;&#124; source is XmlExpression)
            {
                // nothing to do
            }
            else if (&quot;NullCollectionInitializerExpression&quot; == source.GetType().Name &#124;&#124; &quot;NullExpression&quot; == source.GetType().Name)
            {
                // cant do anything with this type - it is inaccessible
            }

            return null;
        }

        /// 
        /// Traverses the code tree, navigating all INodes
        /// 
        /// The source enumeration
        /// Delegate used when searching.
        /// All INodes in a source file ready to be filtered by the appropriate &quot;Find&quot; method. 
        /// Not all statement types have been implemented as yet. I am implementing on a as needed basis.
        private static IEnumerable Traverse(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate)
        {            
            foreach (INode item in source)
            {
                yield return item;

                IEnumerable seqRecurse = null;
                
                if (item is MethodDeclaration)
                {
                    MethodDeclaration method = item as MethodDeclaration;                    
                    seqRecurse = searchDelegate(method.Body);
                }
                else if (item is IfElseStatement)
                {
                    IfElseStatement ifStatement = item as IfElseStatement;

                    foreach (Statement statement in ifStatement.TrueStatement)
                    {
                        if (statement is BlockStatement)
                        {
                            BlockStatement blockStatement = statement as BlockStatement;

                            foreach (INode itemRecurse in Traverse(blockStatement.Children, searchDelegate))
                            {
                                yield return itemRecurse;
                            }
                        }                        
                    }

                    if (ifStatement.HasElseStatements)
                    {
                        foreach (Statement statement in ifStatement.FalseStatement)
                        {
                            if (statement is BlockStatement)
                            {
                                BlockStatement blockStatement = statement as BlockStatement;

                                foreach (INode itemRecurse in Traverse(blockStatement.Children, searchDelegate))
                                {
                                    yield return itemRecurse;
                                }
                            }
                        }
                    }

                    if (ifStatement.HasElseIfSections)
                    {
                        foreach (ElseIfSection elseIfSection in ifStatement.ElseIfSections)
                        {
                            foreach (INode itemRecurse in Traverse(elseIfSection.EmbeddedStatement.Children, searchDelegate))
                            {
                                yield return itemRecurse;
                            }
                        }
                    }
                }
                else if (item is SwitchStatement)
                {
                    foreach (SwitchSection switchSection in (item as SwitchStatement).SwitchSections)
                    {
                        foreach (INode itemRecurse in Traverse(switchSection.Children, searchDelegate))
                        {
                            yield return itemRecurse;
                        }
                    }
                }
                else if (item is StatementWithEmbeddedStatement)
                {
                    StatementWithEmbeddedStatement embeddedStatement = item as StatementWithEmbeddedStatement;
                    foreach (INode itemRecurse in Traverse(embeddedStatement.EmbeddedStatement.Children, searchDelegate))
                    {
                        yield return itemRecurse;
                    }
                }
                else if (item is TryCatchStatement)
                {
                    TryCatchStatement tryCatch = item as TryCatchStatement;

                    foreach (INode itemRecurse in Traverse(tryCatch.StatementBlock.Children, searchDelegate))
                    {
                        yield return itemRecurse;
                    }

                    foreach (CatchClause catchClause in tryCatch.CatchClauses)
                    {
                        foreach (INode itemRecurse in Traverse(catchClause.StatementBlock.Children, searchDelegate))
                        {
                            yield return itemRecurse;
                        }
                    }

                    foreach (INode itemRecurse in Traverse(tryCatch.FinallyBlock.Children, searchDelegate))
                    {
                        yield return itemRecurse;
                    }
                }
                else if (item is ExpressionStatement)
                {
                    INode node = EvaluateExpression(((ExpressionStatement)item).Expression);

                    if (null != node)
                    {
                        yield return node;
                    }
                }
                else
                {
                    seqRecurse = searchDelegate(item);
                }            
                
                if (seqRecurse != null)
                {
                    foreach (INode itemRecurse in Traverse(seqRecurse, searchDelegate))
                    {                        
                        yield return itemRecurse;
                    }
                }
            }
        }
    }
}]]></description>
		<content:encoded><![CDATA[<p>// &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
//<br />
//<br />
//<br />
//<br />
//   Extension methods to facilitate code parsing using LINQ &amp; NRefactory<br />
//<br />
// &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
namespace Rules.FixesLib<br />
{<br />
    using System;<br />
    using System.Collections.Generic;<br />
    using System.Linq;</p>
<p>    using ICSharpCode.NRefactory.Ast;</p>
<p>    ///<br />
    /// Extension methods for processing an enumeration if INode<br />
    ///<br />
    public static class CodeParsingExtensions<br />
    {<br />
        ///<br />
        /// The search criteria specified for a string literal search &#8211; Only used by FindStringLiteral<br />
        ///<br />
        private static string stringliteralSearchCriteria = string.Empty;</p>
<p>        ///<br />
        /// The INodes matching the search criteria &#8211; Only used by FindStringLiteral<br />
        ///<br />
        private static List searchMatches = null;</p>
<p>        ///<br />
        /// Finds the local variables with the specified variable name<br />
        ///<br />
        /// The source enumeration<br />
        /// Delegate used when searching.<br />
        /// Name of the variable to locate.<br />
        /// IEnumerable containing INode that have the specified variable name (case sensitive)<br />
        public static IEnumerable FindLocalVariables(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate, string variableName)<br />
        {<br />
            return source.Traverse(x =&gt; x.Children)<br />
                .Where(x =&gt; x is LocalVariableDeclaration).Cast()<br />
                .Where(x =&gt; x.GetVariableDeclaration(variableName) != null);<br />
        }</p>
<p>        ///<br />
        /// Finds the methods with the specified name<br />
        ///<br />
        /// The source enumeration to search<br />
        /// Delegate used when searching.<br />
        /// Name of the method (case sensitive)<br />
        /// IEnumerable containing INode that have the specified method name<br />
        public static IEnumerable FindMethods(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate, string methodName)<br />
        {<br />
            return source.Traverse(x =&gt; x.Children)<br />
                .Where(x =&gt; x is MethodDeclaration).Cast()<br />
                .Where(x =&gt; x.Name == methodName);<br />
        }</p>
<p>        ///<br />
        /// Finds the string literal<br />
        ///<br />
        /// The source enumeration to search<br />
        /// Delegate used when searching.<br />
        /// Content of the literal (case sensitive)<br />
        /// IEnumerable of parent INodes containing the string literal.<br />
        public static IEnumerable FindStringLiteral(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate, string literalContent)<br />
        {<br />
            stringliteralSearchCriteria = literalContent;</p>
<p>            // populated when expressions are evaluated<br />
            searchMatches = new List();</p>
<p>            source.Traverse(x =&gt; x.Children).Where(x =&gt; x is ExpressionStatement).ToList();</p>
<p>            return searchMatches;<br />
        }</p>
<p>        ///<br />
        /// Evaluates an expression and all nested expressions<br />
        ///<br />
        /// The source enumeration<br />
        /// INode containing an expression<br />
        /// This is fairly ugly. In this instance the EvaluateExpression function is used only to support the FindStringLiteral method. It could be extended for more search methods if required.<br />
        private static INode EvaluateExpression(Expression source)<br />
        {<br />
            ////ICSharpCode.NRefactory.Ast.QueryExpressionVB &#8211; unsupported right now</p>
<p>            if (source is AddressOfExpression)<br />
            {<br />
                AddressOfExpression a = source as AddressOfExpression;<br />
                return EvaluateExpression(a.Expression);<br />
            }<br />
            else if (source is AnonymousMethodExpression)<br />
            {<br />
                AnonymousMethodExpression a = source as AnonymousMethodExpression;<br />
                foreach (Expression parameterExpression in a.Parameters)<br />
                {<br />
                    if (null != EvaluateExpression(parameterExpression))<br />
                    {<br />
                        return a.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is ArrayCreateExpression)<br />
            {<br />
                ArrayCreateExpression a = source as ArrayCreateExpression;</p>
<p>                if (null != EvaluateExpression(a.ArrayInitializer))<br />
                {<br />
                    return a.Parent;<br />
                }</p>
<p>                foreach (Expression argumentExpression in a.Arguments)<br />
                {<br />
                    if (null != EvaluateExpression(argumentExpression))<br />
                    {<br />
                        return a.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is AssignmentExpression)<br />
            {<br />
                AssignmentExpression a = source as AssignmentExpression;</p>
<p>                if (null != EvaluateExpression(a.Left))<br />
                {<br />
                    return a.Parent;<br />
                }</p>
<p>                if (null != EvaluateExpression(a.Right))<br />
                {<br />
                    return a.Parent;<br />
                }<br />
            }<br />
            else if (source is BinaryOperatorExpression)<br />
            {<br />
                BinaryOperatorExpression b = source as BinaryOperatorExpression;</p>
<p>                if (null != EvaluateExpression(b.Left))<br />
                {<br />
                    return b.Parent;<br />
                }</p>
<p>                if (null != EvaluateExpression(b.Right))<br />
                {<br />
                    return b.Parent;<br />
                }<br />
            }<br />
            else if (source is CastExpression)<br />
            {<br />
                CastExpression c = source as CastExpression;</p>
<p>                if (null != EvaluateExpression(c.Expression))<br />
                {<br />
                    return c.Parent;<br />
                }<br />
            }<br />
            else if (source is CheckedExpression)<br />
            {<br />
                CheckedExpression c = source as CheckedExpression;<br />
                if (null != EvaluateExpression(c.Expression))<br />
                {<br />
                    return c.Parent;<br />
                }<br />
            }<br />
            else if (source is CollectionInitializerExpression)<br />
            {<br />
                CollectionInitializerExpression c = source as CollectionInitializerExpression;<br />
                foreach (Expression createExpression in c.CreateExpressions)<br />
                {<br />
                    if (null != EvaluateExpression(createExpression))<br />
                    {<br />
                        return c.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is ConditionalExpression)<br />
            {<br />
                ConditionalExpression c = source as ConditionalExpression;</p>
<p>                if (null != EvaluateExpression(c.Condition))<br />
                {<br />
                    return c.Parent;<br />
                }</p>
<p>                if (null != EvaluateExpression(c.TrueExpression))<br />
                {<br />
                    return c.Parent;<br />
                }</p>
<p>                if (null != EvaluateExpression(c.FalseExpression))<br />
                {<br />
                    return c.Parent;<br />
                }<br />
            }<br />
            else if (source is DirectionExpression)<br />
            {<br />
                DirectionExpression d = source as DirectionExpression;<br />
                if (null != EvaluateExpression(d.Expression))<br />
                {<br />
                    return d.Parent;<br />
                }<br />
            }<br />
            else if (source is InvocationExpression)<br />
            {<br />
                InvocationExpression i = source as InvocationExpression;</p>
<p>                if (null != EvaluateExpression(i.TargetObject))<br />
                {<br />
                    return i.Parent;<br />
                }</p>
<p>                foreach (Expression argumentExpression in i.Arguments)<br />
                {<br />
                    if (null != EvaluateExpression(argumentExpression))<br />
                    {<br />
                        return i.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is IdentifierExpression)<br />
            {<br />
                IdentifierExpression id = source as IdentifierExpression;<br />
            }<br />
            else if (source is IndexerExpression)<br />
            {<br />
                IndexerExpression id = source as IndexerExpression;<br />
                foreach (Expression indexExpression in id.Indexes)<br />
                {<br />
                    if (null != EvaluateExpression(indexExpression))<br />
                    {<br />
                        return id.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is LambdaExpression)<br />
            {<br />
                LambdaExpression l = source as LambdaExpression;<br />
                if (null != EvaluateExpression(l.ExpressionBody))<br />
                {<br />
                    return l.Parent;<br />
                }<br />
            }<br />
            else if (source is MemberInitializerExpression)<br />
            {<br />
                MemberInitializerExpression m = source as MemberInitializerExpression;<br />
                if (null != EvaluateExpression(m.Expression))<br />
                {<br />
                    return m.Parent;<br />
                }<br />
            }<br />
            else if (source is MemberReferenceExpression)<br />
            {<br />
                MemberReferenceExpression m = source as MemberReferenceExpression;<br />
                if (null != EvaluateExpression(m.TargetObject))<br />
                {<br />
                    return m.Parent;<br />
                }<br />
            }<br />
            else if (source is NamedArgumentExpression)<br />
            {<br />
                NamedArgumentExpression n = source as NamedArgumentExpression;<br />
                if (null != EvaluateExpression(n.Expression))<br />
                {<br />
                    return n.Parent;<br />
                }<br />
            }<br />
            else if (source is ObjectCreateExpression)<br />
            {<br />
                ObjectCreateExpression obj = source as ObjectCreateExpression;<br />
                if (null != EvaluateExpression(obj.ObjectInitializer))<br />
                {<br />
                    return obj.Parent;<br />
                }</p>
<p>                foreach (Expression parameterExpression in obj.Parameters)<br />
                {<br />
                    if (null != EvaluateExpression(parameterExpression))<br />
                    {<br />
                        return obj.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is ParameterDeclarationExpression)<br />
            {<br />
                ParameterDeclarationExpression p = source as ParameterDeclarationExpression;</p>
<p>                if (null != EvaluateExpression(p.DefaultValue))<br />
                {<br />
                    return p.Parent;<br />
                }<br />
            }<br />
            else if (source is ParenthesizedExpression)<br />
            {<br />
                ParenthesizedExpression p = source as ParenthesizedExpression;<br />
                if (null != EvaluateExpression(p.Expression))<br />
                {<br />
                    return p.Parent;<br />
                }<br />
            }<br />
            else if (source is PrimitiveExpression)<br />
            {<br />
                PrimitiveExpression p = source as PrimitiveExpression;</p>
<p>                if (p.StringValue == string.Format(&#8220;\&#8221;{0}\&#8221;", stringliteralSearchCriteria))<br />
                {<br />
                    searchMatches.Add(p.Parent);<br />
                    return p.Parent;<br />
                }<br />
            }<br />
            else if (source is TypeOfIsExpression)<br />
            {<br />
                TypeOfIsExpression t = source as TypeOfIsExpression;<br />
                if (null != EvaluateExpression(t.Expression))<br />
                {<br />
                    return t.Parent;<br />
                }<br />
            }<br />
            else if (source is UnaryOperatorExpression)<br />
            {<br />
                UnaryOperatorExpression u = source as UnaryOperatorExpression;<br />
                if (null != EvaluateExpression(u.Expression))<br />
                {<br />
                    return u.Parent;<br />
                }<br />
            }<br />
            else if (source is UncheckedExpression)<br />
            {<br />
                UncheckedExpression u = source as UncheckedExpression;<br />
                if (null != EvaluateExpression(u.Expression))<br />
                {<br />
                    return u.Parent;<br />
                }<br />
            }<br />
            else if (source is XmlAttributeExpression)<br />
            {<br />
                XmlAttributeExpression x = source as XmlAttributeExpression;<br />
                if (null != EvaluateExpression(x.ExpressionValue))<br />
                {<br />
                    return x.Parent;<br />
                }<br />
            }<br />
            else if (source is XmlContentExpression)<br />
            {<br />
                XmlContentExpression x = source as XmlContentExpression;<br />
            }<br />
            else if (source is XmlDocumentExpression)<br />
            {<br />
                XmlDocumentExpression x = source as XmlDocumentExpression;<br />
                foreach (XmlExpression xmlExpression in x.Expressions)<br />
                {<br />
                    if (null != EvaluateExpression(xmlExpression))<br />
                    {<br />
                        return x.Parent;<br />
                    }<br />
                }<br />
            }<br />
            else if (source is XmlElementExpression)<br />
            {<br />
                XmlElementExpression x = source as XmlElementExpression;<br />
                if (null != EvaluateExpression(x.Content))<br />
                {<br />
                    return x.Parent;<br />
                }</p>
<p>                if (null != EvaluateExpression(x.NameExpression))<br />
                {<br />
                    return x.Parent;<br />
                }<br />
            }<br />
            else if (source is XmlEmbeddedExpression)<br />
            {<br />
                XmlEmbeddedExpression x = source as XmlEmbeddedExpression;<br />
                if (null != EvaluateExpression(x.InlineVBExpression))<br />
                {<br />
                    return x.Parent;<br />
                }<br />
            }<br />
            else if (source is XmlMemberAccessExpression)<br />
            {<br />
                XmlMemberAccessExpression x = source as XmlMemberAccessExpression;<br />
                if (null != EvaluateExpression(x.TargetObject))<br />
                {<br />
                    return x.Parent;<br />
                }<br />
            }<br />
            else if (source is BaseReferenceExpression || source is ClassReferenceExpression ||<br />
                     source is DefaultValueExpression || source is QueryExpression || source is TypeOfExpression ||<br />
                     source is TypeReferenceExpression || source is ThisReferenceExpression ||<br />
                     source is SizeOfExpression || source is XmlExpression)<br />
            {<br />
                // nothing to do<br />
            }<br />
            else if (&#8220;NullCollectionInitializerExpression&#8221; == source.GetType().Name || &#8220;NullExpression&#8221; == source.GetType().Name)<br />
            {<br />
                // cant do anything with this type &#8211; it is inaccessible<br />
            }</p>
<p>            return null;<br />
        }</p>
<p>        ///<br />
        /// Traverses the code tree, navigating all INodes<br />
        ///<br />
        /// The source enumeration<br />
        /// Delegate used when searching.<br />
        /// All INodes in a source file ready to be filtered by the appropriate &#8220;Find&#8221; method.<br />
        /// Not all statement types have been implemented as yet. I am implementing on a as needed basis.<br />
        private static IEnumerable Traverse(this IEnumerable source, Func&lt;INode, IEnumerable&gt; searchDelegate)<br />
        {<br />
            foreach (INode item in source)<br />
            {<br />
                yield return item;</p>
<p>                IEnumerable seqRecurse = null;</p>
<p>                if (item is MethodDeclaration)<br />
                {<br />
                    MethodDeclaration method = item as MethodDeclaration;<br />
                    seqRecurse = searchDelegate(method.Body);<br />
                }<br />
                else if (item is IfElseStatement)<br />
                {<br />
                    IfElseStatement ifStatement = item as IfElseStatement;</p>
<p>                    foreach (Statement statement in ifStatement.TrueStatement)<br />
                    {<br />
                        if (statement is BlockStatement)<br />
                        {<br />
                            BlockStatement blockStatement = statement as BlockStatement;</p>
<p>                            foreach (INode itemRecurse in Traverse(blockStatement.Children, searchDelegate))<br />
                            {<br />
                                yield return itemRecurse;<br />
                            }<br />
                        }<br />
                    }</p>
<p>                    if (ifStatement.HasElseStatements)<br />
                    {<br />
                        foreach (Statement statement in ifStatement.FalseStatement)<br />
                        {<br />
                            if (statement is BlockStatement)<br />
                            {<br />
                                BlockStatement blockStatement = statement as BlockStatement;</p>
<p>                                foreach (INode itemRecurse in Traverse(blockStatement.Children, searchDelegate))<br />
                                {<br />
                                    yield return itemRecurse;<br />
                                }<br />
                            }<br />
                        }<br />
                    }</p>
<p>                    if (ifStatement.HasElseIfSections)<br />
                    {<br />
                        foreach (ElseIfSection elseIfSection in ifStatement.ElseIfSections)<br />
                        {<br />
                            foreach (INode itemRecurse in Traverse(elseIfSection.EmbeddedStatement.Children, searchDelegate))<br />
                            {<br />
                                yield return itemRecurse;<br />
                            }<br />
                        }<br />
                    }<br />
                }<br />
                else if (item is SwitchStatement)<br />
                {<br />
                    foreach (SwitchSection switchSection in (item as SwitchStatement).SwitchSections)<br />
                    {<br />
                        foreach (INode itemRecurse in Traverse(switchSection.Children, searchDelegate))<br />
                        {<br />
                            yield return itemRecurse;<br />
                        }<br />
                    }<br />
                }<br />
                else if (item is StatementWithEmbeddedStatement)<br />
                {<br />
                    StatementWithEmbeddedStatement embeddedStatement = item as StatementWithEmbeddedStatement;<br />
                    foreach (INode itemRecurse in Traverse(embeddedStatement.EmbeddedStatement.Children, searchDelegate))<br />
                    {<br />
                        yield return itemRecurse;<br />
                    }<br />
                }<br />
                else if (item is TryCatchStatement)<br />
                {<br />
                    TryCatchStatement tryCatch = item as TryCatchStatement;</p>
<p>                    foreach (INode itemRecurse in Traverse(tryCatch.StatementBlock.Children, searchDelegate))<br />
                    {<br />
                        yield return itemRecurse;<br />
                    }</p>
<p>                    foreach (CatchClause catchClause in tryCatch.CatchClauses)<br />
                    {<br />
                        foreach (INode itemRecurse in Traverse(catchClause.StatementBlock.Children, searchDelegate))<br />
                        {<br />
                            yield return itemRecurse;<br />
                        }<br />
                    }</p>
<p>                    foreach (INode itemRecurse in Traverse(tryCatch.FinallyBlock.Children, searchDelegate))<br />
                    {<br />
                        yield return itemRecurse;<br />
                    }<br />
                }<br />
                else if (item is ExpressionStatement)<br />
                {<br />
                    INode node = EvaluateExpression(((ExpressionStatement)item).Expression);</p>
<p>                    if (null != node)<br />
                    {<br />
                        yield return node;<br />
                    }<br />
                }<br />
                else<br />
                {<br />
                    seqRecurse = searchDelegate(item);<br />
                }            </p>
<p>                if (seqRecurse != null)<br />
                {<br />
                    foreach (INode itemRecurse in Traverse(seqRecurse, searchDelegate))<br />
                    {<br />
                        yield return itemRecurse;<br />
                    }<br />
                }<br />
            }<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-59</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 10:45:32 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-59</guid>
		<description><![CDATA[// --------------------------------------------------------------------------------------------------------------------
// 
//   
// 
// 
//   Interface describing a rule that can be fixed automatically by the Extenstion
// 
// --------------------------------------------------------------------------------------------------------------------
namespace Rules.FixesLib
{
    /// 
    /// Interface describing a rule that can be fixed automatically by the Extenstion
    /// 
    public interface IFixableRule
    {
        /// 
        /// Gets or sets the error message.
        /// 
        /// 
        /// The error message.
        /// 
        string ErrorMessage { get; set; }

        /// 
        /// Gets or sets the fixed line number.
        /// 
        /// 
        /// The fixed line number.
        /// 
        /// 
        /// This is the location in code where the fix has been applied, used to move the editor to the approximate position of the change
        /// 
        int FixedLineNumber { get; set; }

        /// 
        /// Gets or sets the fixed column number.
        /// 
        /// 
        /// The fixed column number.
        /// 
        /// 
        /// This is the location in code where the fix has been applied, used to move the editor to the approximate position of the change
        /// 
        int FixedColumnNumber { get; set; }

        /// 
        /// Gets a value indicating whether this instance is breaking rule.
        /// 
        /// 
        ///    true if this instance is breaking rule; otherwise, false.
        /// 
        bool IsBreakingRule { get; }

        /// 
        /// Gets the rule identifier.
        /// 
        string RuleIdentifier { get; }

        /// 
        /// Fixes the violation.
        /// 
        /// The original file.
        /// The line number.
        /// The column.
        /// string, containing the fixed source code
        string FixViolation(string originalFile, int? lineNumber, int? column);
    }
}]]></description>
		<content:encoded><![CDATA[<p>// &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
//<br />
//<br />
//<br />
//<br />
//   Interface describing a rule that can be fixed automatically by the Extenstion<br />
//<br />
// &#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<br />
namespace Rules.FixesLib<br />
{<br />
    ///<br />
    /// Interface describing a rule that can be fixed automatically by the Extenstion<br />
    ///<br />
    public interface IFixableRule<br />
    {<br />
        ///<br />
        /// Gets or sets the error message.<br />
        ///<br />
        ///<br />
        /// The error message.<br />
        ///<br />
        string ErrorMessage { get; set; }</p>
<p>        ///<br />
        /// Gets or sets the fixed line number.<br />
        ///<br />
        ///<br />
        /// The fixed line number.<br />
        ///<br />
        ///<br />
        /// This is the location in code where the fix has been applied, used to move the editor to the approximate position of the change<br />
        ///<br />
        int FixedLineNumber { get; set; }</p>
<p>        ///<br />
        /// Gets or sets the fixed column number.<br />
        ///<br />
        ///<br />
        /// The fixed column number.<br />
        ///<br />
        ///<br />
        /// This is the location in code where the fix has been applied, used to move the editor to the approximate position of the change<br />
        ///<br />
        int FixedColumnNumber { get; set; }</p>
<p>        ///<br />
        /// Gets a value indicating whether this instance is breaking rule.<br />
        ///<br />
        ///<br />
        ///    true if this instance is breaking rule; otherwise, false.<br />
        ///<br />
        bool IsBreakingRule { get; }</p>
<p>        ///<br />
        /// Gets the rule identifier.<br />
        ///<br />
        string RuleIdentifier { get; }</p>
<p>        ///<br />
        /// Fixes the violation.<br />
        ///<br />
        /// The original file.<br />
        /// The line number.<br />
        /// The column.<br />
        /// string, containing the fixed source code<br />
        string FixViolation(string originalFile, int? lineNumber, int? column);<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Jan Kinable</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-58</link>
		<dc:creator><![CDATA[Jan Kinable]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 09:17:39 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-58</guid>
		<description><![CDATA[I&#039;m very happy with your contribution! My FileManager was indeed somewhat &#039;cheap&#039;. Post me your code and I&#039;ll update the extension on the Visual Studio gallery. I&#039;ll give you the credits offcourse ;-)]]></description>
		<content:encoded><![CDATA[<p>I&#8217;m very happy with your contribution! My FileManager was indeed somewhat &#8216;cheap&#8217;. Post me your code and I&#8217;ll update the extension on the Visual Studio gallery. I&#8217;ll give you the credits offcourse <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-57</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 31 Aug 2011 08:48:04 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-57</guid>
		<description><![CDATA[I have been working on this and have implemented my own FixesLib containg an updated version of your original interface and an extension class that allows some basic LINQ querying of the source file using NRefactory to replace your file manager. Happy to share with you if you would like it.]]></description>
		<content:encoded><![CDATA[<p>I have been working on this and have implemented my own FixesLib containg an updated version of your original interface and an extension class that allows some basic LINQ querying of the source file using NRefactory to replace your file manager. Happy to share with you if you would like it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Extending FxCop Rules with fixing ability by Steve</title>
		<link>http://vsxexperience.net/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-56</link>
		<dc:creator><![CDATA[Steve]]></dc:creator>
		<pubDate>Wed, 20 Jul 2011 10:56:41 +0000</pubDate>
		<guid isPermaLink="false">https://vsxexperience.wordpress.com/2011/06/28/extending-fxcop-rules-with-fixing-ability/#comment-56</guid>
		<description><![CDATA[Great stuff, just what I was looking for.]]></description>
		<content:encoded><![CDATA[<p>Great stuff, just what I was looking for.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

