Skip to content

CS0267 error message no longer correct (for C#9 partial methods) #48472

@amis92

Description

@amis92

Version Used:

Microsoft Visual Studio Community 2019 Preview
Version 16.8.0 Preview 3.1

C# Tools 3.8.0-3.20458.6+b446afd34759150c2ea3b86ab794104e12e64db1

Steps to Reproduce:

  1. Write code:
class X
{
    partial public string Foo();
}
  1. Observe CS0267 on partial modifier.
  2. Be confused by error message.

Expected Behavior:

Error message communicating invalid partial placement taking new partial methods (non-void) into account. I don't have a good proposal, but maybe addition of 'or method return type' would be enough.

Actual Behavior:

CS0267 says

The partial modifier can only appear immediately before 'class', 'record', 'struct', 'interface' or 'void'

It misses the non-void return type allowed on C#9 partial methods.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions