Skip to content

DllImportGenerator should error if attribute is applied to an extern #62700

Closed
@danmoseley

Description

@danmoseley

Bug #62616 was caused by applying [GeneratedDllImport] to an extern rather than partial method. The compilation succeeded, but the analyzer ignored it, and there was a failure at runtime.

  1. The generator should error if it is applied to any method declaration that does not lead the generator to actually run.
  2. Optionally, I suggest trimming (no RVA). from this message:
    IDS_CLASSLOAD_MISSINGMETHODRVA "Could not load type '%1' from assembly '%2' because the method '%3' has no implementation (no RVA)."

because it's what you see in this case, and it seems a rather technical distraction - not sure how relative virtual address is helpful here, the essential fact is that the implementation is missing.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions