Skip to content

Partial extern members missing warning about DllImport #77029

@jjonescz

Description

@jjonescz

Version Used: main

Steps to Reproduce:

partial class C
{
    public partial void M1();
    public extern partial void M1();

    public extern void M2();
}

Expected Behavior: M1 and M2 to get the same warnings since they are equivalent.

Actual Behavior: Only M2 gets this warning:

// /TestProject/Program.cs(6,24): warning CS0626: Method, operator, or accessor 'C.M2()' is marked external and has no attributes on it. Consider adding a DllImport attribute to specify the external implementation.
//     public extern void M2();
Diagnostic(ErrorCode.WRN_ExternMethodNoImplementation, "M2").WithArguments("C.M2()").WithLocation(6, 24)

Notes: See c2c76c9 where I started fixing this for partial events and constructors but reverted it since it seems orthogonal to the feature.

Metadata

Metadata

Assignees

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions