Repository navigation
Fix XML documentation with colliding Win32 ABI types - #1828
Merged
Jevan Saks (jevansaks) merged 2 commits intoOct 7, 2026
Merged
Conversation
Copy native API docs to friendly overloads when referenced assemblies contain duplicate ABI type names. Use canonical documentation IDs for PWSTR member docs and cover the shared-ABI regression. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Member
|
I am not fluent in compiler error codes so I don't offhand know what CS1580/CS1574 are. Can you update the PR description or issue report to include a minimal repro or output of the offending generated code? |
Remove generated documentation text assertions while retaining compiler and XML emission checks and ABI reuse guards. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Member
Author
|
Jevan Saks (@jevansaks) I've updated the title for clarity and included the full error messages in the description. |
Jevan Saks (jevansaks)
approved these changes
Oct 7, 2026
Jevan Saks (jevansaks)
enabled auto-merge (squash)
October 7, 2026 21:49
Jevan Saks (jevansaks)
deleted the
user/sergiopedri/fix-createwindowex-doc-cref
branch
October 7, 2026 22:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix friendly-overload XML documentation errors when another referenced assembly embeds an internal Win32 ABI type with the same full name as a public type supplied by the product ABI assembly. The compiler messages are (the
CreateWindowExsignature is abbreviated here; the full messages appear below):Invalid type for parameter winmdroot.Foundation.PCWSTR in XML comment cref attribute: 'CreateWindowEx(...)'XML comment has cref attribute 'CreateWindowEx(...)' that could not be resolvedCS1580 is reported for each of the two
PCWSTRparameters; CS1574 is reported for the unresolved reference as a whole.<param>docs for parameters the overload removes. Keep normal<inheritdoc cref>generation unchanged otherwise.PWSTRmember links and add two-assembly regression coverage forCreateWindowEx, optional parameters, and the extension-receiver path.Reproduction
The supplied repro uses CsWin32 0.3.333 and Win32Metadata 71.0.26-preview:
Interop.Abigenerates publicFindWindowinterop, includingWindows.Win32.Foundation.PCWSTR.Interop.Consumerreferences that project andShmuelie.WinRTServer2.2.1, which embeds an internal type with the same full name. The consumer requestsCreateWindowExwith XML documentation enabled.TreatWarningsAsErrors=truereports two CS1580 diagnostics and one CS1574. RemovingShmuelie.WinRTServermakes the build pass.The C# method signature correctly binds to the public ABI type. XML
crefbinding also considers the inaccessible duplicate, so it cannot resolve the friendly overload's reference to the native overload. Fully qualifying the type names does not remove the conflict.Offending generated code and diagnostics
Here is the generated native declaration from the regression before the documentation fix (surrounding attributes and documentation omitted):
The friendly overload accepting
stringparameters has this generated documentation, which fails to bind despite the valid native declaration:/// <inheritdoc cref="CreateWindowEx(winmdroot.UI.WindowsAndMessaging.WINDOW_EX_STYLE, winmdroot.Foundation.PCWSTR, winmdroot.Foundation.PCWSTR, winmdroot.UI.WindowsAndMessaging.WINDOW_STYLE, int, int, int, int, winmdroot.Foundation.HWND, winmdroot.UI.WindowsAndMessaging.HMENU, winmdroot.Foundation.HINSTANCE, void*)"/>The compiler reports CS1580 for each of the two
PCWSTRparameters (invalid parameter type in an XML reference) and CS1574 for the entire reference (XML reference could not be resolved). Representative messages from the failing regression:Verification
Rebuilding the supplied consumer with this branch's generator, XML docs enabled, and
TreatWarningsAsErrors=truesucceeds with zero warnings. Targeted generator, composition, COM, and CLI tests pass.The regression tests check compiler diagnostics and XML documentation emission rather than exact generated documentation text, retaining guards that the referenced
PCWSTRis reused and friendly overloads are generated. All 16 friendly-overload tests pass. Temporarily disabling the ambiguity fix reproduces CS1580/CS1574 in all four duplicate-type cases while the four controls pass; restoring the oldPWSTRlinks triggers CS1574 in the extension-receiver case, and omitting parameter-documentation filtering triggers CS1572 for the removedSecurityDescriptorSizeparameter. All temporary mutations were reverted.