-
Notifications
You must be signed in to change notification settings - Fork 983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove CoClass usages from System.Windows.Forms #4971
Conversation
This helps make WinForms application more ILLink/NativeAOT-friendly
@JeremyKuhne @AaronRobinsonMSFT may I get you to review this one? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a few comments with suggestions, note that these apply to all three locations but I only annotated the first occurence since the others are identical.
src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, I've no real issues with this change as it just makes the veneer over COM class activation explicit. I don't fully get why this needed. However, I'm not plugged into all the NativeAOT work so I could see a case for this change being cheaper than supporting how .NET has traditionally activated a COM class.
src/System.Windows.Forms/src/System/Windows/Forms/FolderBrowserDialog.cs
Outdated
Show resolved
Hide resolved
@AaronRobinsonMSFT I suspect that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good with the open discussion about removing the IIDs and calling CoCreateInstance with IID_IUnknown instead which already has a constant.
Also it may be worth moving the CLSID constants into the interop files, after all these are constants from the win32 API. Not sure where they would go though @RussKie
src/System.Windows.Forms/src/System/Windows/Forms/SaveFileDialog.cs
Outdated
Show resolved
Hide resolved
I'd say under the root in Interop. Following the existing pattern of Note that there is cost to having these take strings (I don't think it gets optimized away). It might be worth changing these to |
@JeremyKuhne can you take a look? |
src/System.Windows.Forms.Primitives/src/Interop/Interop.CLSID.cs
Outdated
Show resolved
Hide resolved
src/System.Windows.Forms.Primitives/src/Interop/Interop.CLSID.cs
Outdated
Show resolved
Hide resolved
@kant2002 Jeremy is currently OOF, will be back next week. |
Co-authored-by: Igor Velikorossov <[email protected]>
Co-authored-by: Igor Velikorossov <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
Thank you all. |
This helps make WinForms application more ILLink/NativeAOT-friendly
Fixes #4940
Microsoft Reviewers: Open in CodeFlow