WiseTechGlobal/WTG.Analyzers

WTG1018 InvalidCastException

Closed this issue · 3 comments

* Solution: ConfigurationModel.Validation.sln (7/7)...
  - Found 9 projects.
Analyzer 'WTG.Analyzers.BooleanLiteralAnalyzer' threw an exception of type 'System.InvalidCastException' with message 'Unable to cast object of type 'Microsoft.CodeAnalysis.CSharp.Syntax.TupleExpressionSyntax' to type 'Microsoft.CodeAnalysis.CSharp.Syntax.ArgumentListSyntax'.'.

I'm not sure yet exactly which code is triggering this.

Another error:

* Solution: WinMobile.sln (1/7)...
  - Found 8 projects.
Analyzer 'WTG.Analyzers.BooleanLiteralAnalyzer' threw an exception of type 'System.IndexOutOfRangeException' with message 'Index was outside the bounds of the array.'.

The IndexOutOfRangeException looks to be due to the argument being a params array:

void Foo(params object[] args) { ... }

Foo("Thing", true); // Explode

InvalidCastException is due to the argument being a tuple argument, not a method argument:

return (true, null);