1
Vote

Error after upgrading StyleCop

description

First of all apologize my English.
We recently moved to Visual Studio 2015 and it was necessary update the StyleCop as well.
All versions after 4.7.49.0, (which support visual studio 2015) generate the following error at StyleCop+ plugin:

Warning SA0001 : CoreParser : An exception occurred while parsing the file: System.InvalidCastException, Unable to cast object of type 'StyleCop.CSharp.IsExpression' to type 'StyleCop.CSharp.LambdaExpression'.
at StyleCopPlus.CodeHelper.GetParametersExpressionVisitor(Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, List1 result) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Code\CodeHelper\CodeHelper.cs:line 314
at StyleCop.CSharp.CodeWalker
1.VisitExpression(Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, T& context)
at StyleCop.CSharp.CodeWalker1.WalkExpression(Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker
1.WalkExpression(Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker1.WalkExpression(Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker
1.WalkExpression(Expression expression, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker1.WalkStatement(Statement statement, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker
1.WalkStatement(Statement statement, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker1.WalkStatement(Statement statement, Expression parentExpression, Statement parentStatement, CsElement parentElement, T context)
at StyleCop.CSharp.CodeWalker
1.WalkElement(CsElement element, CsElement parentElement, T context)
at StyleCopPlus.CodeHelper.GetParameters(CsElement element) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Code\CodeHelper\CodeHelper.cs:line 280
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.CheckParameters(CsElement element, CurrentNamingSettings settings) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 350
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.AnalyzeMethod(CsElement element, CurrentNamingSettings settings) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 259
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.AnalyzeElement(CsElement element, CurrentNamingSettings settings) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 90
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.AnalyzeElements(IEnumerable1 elements, CurrentNamingSettings settings) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 47
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.AnalyzeElements(IEnumerable
1 elements, CurrentNamingSettings settings) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 48
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.AnalyzeElements(IEnumerable1 elements, CurrentNamingSettings settings) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 48
at StyleCopPlus.Plugin.AdvancedNaming.AdvancedNamingRules.AnalyzeDocument(CodeDocument document) in c:\Temp\StyleCopPlus-master\StyleCopPlus\Plugin\AdvancedNaming\AdvancedNamingRules.cs:line 33
at StyleCopPlus.StyleCopPlusRules.AnalyzeDocument(CodeDocument document) in c:\Temp\StyleCopPlus-master\StyleCopPlus\StyleCopPlusRules.cs:line 88
at StyleCop.StyleCopThread.RunAnalyzers(CodeDocument document, SourceParser parser, IEnumerable
1 analyzers)
at StyleCop.StyleCopThread.TestAndRunAnalyzers(CodeDocument document, SourceParser parser, IEnumerable`1 analyzers, Int32 passNumber)
at StyleCop.StyleCopThread.ParseAndAnalyzeDocument(SourceCode sourceCode, DocumentAnalysisStatus documentStatus)
at StyleCop.StyleCopThread.DoWork(Object sender).

We can't address the code line generating this error because it always points to column 1/line 1.

comments

igest wrote Jan 16 at 10:52 PM

We've noticed our issue is the same of #11107.