Skip to content

Support AssociatedEnum annotation on parameters and fields - #1856

Closed
Jevan Saks (jevansaks) wants to merge 1 commit into
mainfrom
jevansa-microsoft-shift-left-compatibility
Closed

Jevan Saks (jevansaks) wants to merge 1 commit into
mainfrom
jevansa-microsoft-shift-left-compatibility

Conversation

@jevansaks

Copy link
Copy Markdown
Member

Summary

  • Project AssociatedEnum annotations directly as enum types when the enum's declared underlying type matches the native storage, including signedness.
  • Support scalar and return parameters, pointers, buffers, callbacks, and struct fields with runtime marshaling enabled or disabled. Preserve the existing native-backed property shape for compatible scalar fields.
  • Report warning PInvoke015 for incompatible associations and preserve the native types. Enum underlying types, members, values, and flags are never rewritten.

Compatibility

Some existing Windows metadata annotations disagree with their associated enums' storage. Those sites now expose their original native integer types instead of converting enum views, so affected callers may need explicit casts until the metadata is corrected.

Coverage

Includes all eight integral enum storage types, x86/x64/ARM64 projections, request-order independence, namespace/reference resolution, fixed and flexible arrays, warning delivery through both generation frontends, actual LibraryImport generation, and an executed COM ABI check.

Replaces #1855 with a standalone change from an in-repository branch targeting main. SafeHandle ownership changes and the unrelated compatibility harness are excluded.

Project ABI-compatible enum storage directly for native signatures and buffer elements. Preserve native-backed scalar field properties and report PInvoke015 with native fallback for incompatible metadata.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 551c26b9-812d-47f4-9c39-9fd3344e17ce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant