You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
using System;using System.Linq;classTypeSymbol{public System.Collections.Generic.IList<int> AllInterfaces {get;set;}}classTypeName{voidFoo(){vartypeSymbol=new TypeSymbol();if(!typeSymbol?.AllInterfaces.Any(i => i.ToString()=="")??true)return;}}
Both CC0043 and CC0092 will crash with an NullReferenceException when the Any or All invocation is complex, composed of more than one Member Access. So, instead of A.Any, which works, A.B.Any will fail. But only when composed with an elvis operator, like A?.B.Any.
This is happening at the UnusedParametersAnalyzer.cs, line 153. (See it here).
Here is the code that is causing the analysis to fail, from UnusedParametersAnalyzer.cs:
giggio
changed the title
BUG on CC0043 and CC0092 (ChangeAnyToAll) when invocation is complex
BUG on CC0043 and CC0092 (ChangeAnyToAll) when invocation is has elvis operator
Dec 30, 2015
giggio
added a commit
to giggio/code-cracker
that referenced
this issue
Dec 31, 2015
giggio
changed the title
BUG on CC0043 and CC0092 (ChangeAnyToAll) when invocation is has elvis operator
BUG on CC0043 and CC0092 (ChangeAnyToAll) when invocation has elvis operator
Dec 31, 2015
Here is the test case that will fail:
Both
CC0043
andCC0092
will crash with an NullReferenceException when theAny
orAll
invocation is complex, composed of more than one Member Access. So, instead ofA.Any
, which works,A.B.Any
will fail. But only when composed with an elvis operator, likeA?.B.Any
.This is happening at the
UnusedParametersAnalyzer.cs
, line 153. (See it here).Here is the code that is causing the analysis to fail, from
UnusedParametersAnalyzer.cs
:The error is being raised at line 62 (see it here):
These are the variable values at that point:
The text was updated successfully, but these errors were encountered: