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

Intellisence ignores protected accessibility for constructor in derived classes #70235

Closed
syrompetka opened this issue Oct 4, 2023 · 0 comments · Fixed by #75642
Closed

Intellisence ignores protected accessibility for constructor in derived classes #70235

syrompetka opened this issue Oct 4, 2023 · 0 comments · Fixed by #75642
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone

Comments

@syrompetka
Copy link

Steps to Reproduce:

Following code:

public class Derived:BaseClass
{
    public Derived() : base(1) { }
    public void Do()
    {
        var baseInstance = new BaseClass(1, 1);
    }
}

public class BaseClass
{
    public BaseClass(int val) { }
    protected BaseClass(int val, int val1) { } 
}

Produces compilation error since calling protected constuctor from method even in derived class is not allowed.
But VS ignores this fact and during editing offers such constuctor as available one:
image

Expected Behavior:
Protected constuctors from derived class methods are filtered out from suggestions.

Actual Behavior:
VS suggests not compilable completion.

@dotnet-issue-labeler dotnet-issue-labeler bot added Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 4, 2023
@CyrusNajmabadi CyrusNajmabadi added help wanted The issue is "up for grabs" - add a comment if you are interested in working on it Area-IDE and removed Area-Compilers untriaged Issues and PRs which have not yet been triaged by a lead labels Oct 4, 2023
@CyrusNajmabadi CyrusNajmabadi added this to the Backlog milestone Oct 4, 2023
@github-project-automation github-project-automation bot moved this to InQueue in Small Fixes Oct 22, 2024
@github-project-automation github-project-automation bot moved this from InQueue to Completed in Small Fixes Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-IDE help wanted The issue is "up for grabs" - add a comment if you are interested in working on it
Projects
Status: Completed
Development

Successfully merging a pull request may close this issue.

2 participants