csharp-styleguide
csharp-styleguide copied to clipboard
NI1017 fails to report errors in certain expressions.
The code below should report an NI1017 error but does not because it is in the last section of a ternary operator. Errors in the first value of ternarys are reported correctly.
private static IEnumerable
Likewise violations in a return statement are not reported. If you assign to a local then return the local, the error is reported.
private static int Expression(IEnumerable
The reason why it fails to report is because by registration https://github.com/ni/csharp-styleguide/blob/3827066521a2b000a9e36f60251382502b2efb32/src/NationalInstruments.Analyzers/Style/ChainOfMethodsWithLambdasAnalyzer.cs#L38
The syntax node in the second example is InvocationExpression
Have to check that node as the root node