Skip to content

LGTM.com - false positive - Variable ... may be null - C# #2785

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
brendankowitz opened this issue Feb 6, 2020 · 1 comment
Open

LGTM.com - false positive - Variable ... may be null - C# #2785

brendankowitz opened this issue Feb 6, 2020 · 1 comment
Assignees

Comments

@brendankowitz
Copy link

Description of the false positive

The alert is generated from the following snippet:

EnsureArg.IsNotNull(bundleConfiguration?.Value, nameof(bundleConfiguration));
// ...
_bundleConfiguration = bundleConfiguration.Value;

EnsureArg is a third party library used to check arguments. Here, because of the null-conditional, bundleConfiguration and bundleConfiguration.Value are guarded against nulls in this case.

https://lgtm.com/projects/g/microsoft/fhir-server/snapshot/5a4188bc14abc65f5509d1aea5d5cf87648a85a3/files/src/Microsoft.Health.Fhir.Shared.Api/Features/Resources/Bundle/BundleHandler.cs?sort=name&dir=ASC&mode=heatmap#x6213a27b1dff5ecf:1

@calumgrant
Copy link
Contributor

Thank you for this report. We can certainly teach our queries about the Ensure.That library to test for nulls.

@calumgrant calumgrant self-assigned this Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants