I have used more number of of first or default in the groupby of a list in c# it ishows an error as
‘g.firstordefault()’ is null on at least one execution path.
For every firstOrDefault function how to handle it
In these I might get the id values but i may get the other values as null so how to handle this error
Please help me to solve this
Make sure to read this post before raising a thread here:
Then tell us:
- What language is this for?
- Which rule?
- Why do you believe it’s a false-positive/false-negative?
- Are you using
- SonarCloud?
- SonarQube - which version?
- SonarLint - which IDE/version?
- in connected mode with SonarQube or SonarCloud?
- How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)