Bug description
A clear and concise description of what the bug is.
- Version of the vssdk-analyzers: 16.3.14
- Analyzer rule: VSSDK006
- Error (exception message, type, and callstack where applicable):
Warning VSSDK006 Check whether the result of GetService calls is null.
To Reproduce
Sample code:
var item = provider.GetService(typeof(EnvDTE.ProjectItem)) as EnvDTE.ProjectItem; // <<< warning here
return (item != null) ? item.ContainingProject : null;
Expected behavior
No error since checking item for null is present.
Additional context
This code works fine:
var item = provider.GetService(typeof(EnvDTE.ProjectItem)) as EnvDTE.ProjectItem; // <<< no warning here
if (item != null)
return null;
return item.ContainingProject;