Skip to content

Better QuickInfo for "this" and "base" in combination with => operator #40879

@TobiasSekan

Description

@TobiasSekan

With the modern short method notation, I was ran into the problem that a constructor don't accept a => operator in combination with this and base calls.

For this situation, it would be nicer when the quick info offer a better info about the wrong usage.

    public class MyBaseClass
    {
        public MyBaseClass() {}
    }

    public sealed class MyClass : MyBaseClass
    {
        // Original: The usage of base-keyword is not valid in this context
        // Better: can't use base-keyword with => operator did you mean ": base()" - call
        public MyClass() => base() {}

        // Original: method name expected
        // Better: can't use this-keyword with => operator did you mean ": this()" - call
        public MyClass() => this() {}
    }

Version Used:
Visual Studio Community 2019
Version 16.5.0 Preview 1.0

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions