Skip to content
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

Fix S3900: FN FlowCapture #7013

Closed
wants to merge 3 commits into from
Closed

Fix S3900: FN FlowCapture #7013

wants to merge 3 commits into from

Conversation

Tim-Pohlmann
Copy link
Contributor

Part of #6997

public class Test
{
    public void Configure(string typeMap)
    {
        _ = ((string)typeMap).CompareTo(Condition ? "a" : "b"); // FN
    }
    bool Condition;
}

Example from #6997:

public void Configure(TypeMap typeMap)
{
    var destMember = DestinationMember;

    if(destMember.DeclaringType.ContainsGenericParameters)
    {
        destMember = typeMap.DestinationSetters.Single(m => m.Name == destMember.Name);
    }

    var propertyMap = typeMap.FindOrCreatePropertyMapFor(destMember, typeof(TMember) == typeof(object) ? destMember.GetMemberType() : typeof(TMember));

    Apply(propertyMap);
}

@Tim-Pohlmann Tim-Pohlmann added Type: False Negative Rule is NOT triggered when it should be. Area: CFG/SE CFG and SE related issues. Sprint: SE labels Mar 30, 2023
@Tim-Pohlmann Tim-Pohlmann added this to the 8.56 milestone Mar 30, 2023
@Tim-Pohlmann Tim-Pohlmann self-assigned this Mar 30, 2023
@Tim-Pohlmann Tim-Pohlmann changed the base branch from master to Zsolt/S3900-refactor-parameter-dereference March 30, 2023 15:13
@zsolt-kolbay-sonarsource zsolt-kolbay-sonarsource force-pushed the Zsolt/S3900-refactor-parameter-dereference branch 4 times, most recently from f587d85 to 1426253 Compare March 31, 2023 12:41
Base automatically changed from Zsolt/S3900-refactor-parameter-dereference to feature/SE March 31, 2023 13:01
Base automatically changed from feature/SE to master April 4, 2023 13:05
@sonarcloud
Copy link

sonarcloud bot commented Apr 6, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@Tim-Pohlmann
Copy link
Contributor Author

Closed due to an issue in the LVA creating FPs. If it gets fixed, it might be worthwhile to revisit this PR.

@Tim-Pohlmann Tim-Pohlmann removed this from the 8.56 milestone Jul 12, 2023
@Tim-Pohlmann
Copy link
Contributor Author

Deleting the branch. There is a new method ProgramState.ResolveCaptureAndUnwrapConversion that can be used if needed.

@Tim-Pohlmann Tim-Pohlmann deleted the Tim/S3900-FlowCapture branch July 12, 2023 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: CFG/SE CFG and SE related issues. Type: False Negative Rule is NOT triggered when it should be.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants