Skip to content

C#: Property- and Indexer call targets for partial overrides.#21881

Draft
michaelnebel wants to merge 5 commits into
github:mainfrom
michaelnebel:csharp/propertycalls
Draft

C#: Property- and Indexer call targets for partial overrides.#21881
michaelnebel wants to merge 5 commits into
github:mainfrom
michaelnebel:csharp/propertycalls

Conversation

@michaelnebel
Copy link
Copy Markdown
Contributor

@michaelnebel michaelnebel commented May 21, 2026

It appears that call targets for properties and indexers are missing, when only the getter or setter is overridden.
Assume we have

public class BaseClass
{
    public virtual int Value
    {
        get { return field; }
        set { field = value; }
    }
}

public class DerivedClass1 : BaseClass
{
    public override int Value
    {
        get { return 20; }
    }
}

For the example below, we extract an access to the property Value from DerivedClass1. However, only the getter is overridden, which means that the setter being called is the one from BaseClass.

var d1 = new DerivedClass1();
d1.Value = 11;

Furthermore, the function pointer calls are removed from the set of calls where we are interested in reporting missing call targets (as the class of function pointer calls explicitly overrides the getTarget predicate with none()).

@github-actions github-actions Bot added the C# label May 21, 2026
@michaelnebel michaelnebel changed the title C#: Property call targets. C#: Property/Indexer call targets for partial overrides. May 22, 2026
@michaelnebel michaelnebel changed the title C#: Property/Indexer call targets for partial overrides. C#: Property- and Indexer call targets for partial overrides. May 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant