Skip to content

Make class 'abstract' in VB.NET applies MustOverride incorrectly - should be MustInherit. #50003

@DualBrain

Description

@DualBrain

Version Used:

Visual Studio 2019 v16.8.3

Steps to Reproduce:

Create a class as follows:

Class C
Public MustOverride Sub M()
End Class

Notice the error shown as:

Error BC31411 'C' must be declared 'MustInherit' because it contains methods declared 'MustOverride'.

Hover over the C on the Class line and choose "Show potential fixes" displaying the:

Make class 'abstract'

Choose this and to apply the "fix".

Instead of applying MustInherit, its applying MustOverride; even though the description of the "fix" clearly states the correctly desired result of MustInherit.

Expected Behavior:

Apply MustInherit (not MustOverride) on the Class.

Actual Behavior:

Applies MustOverride which is completely incorrect and produces a completely different set of error(s) that shouldn't have happened if the right thing would have taken place.

Additionally, would be nice if it could state "Make class 'MustInherit'"; though this may be beyond the scope of what code fixes are capable of doing.

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-IDEBugIDE-CodeStyleBuilt-in analyzers, fixes, and refactoringsLanguage-VBhelp wantedThe issue is "up for grabs" - add a comment if you are interested in working on it

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions