-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Convert to using CsWin32 HRESULT definition #10155
base: main
Are you sure you want to change the base?
Conversation
This converts to using the CsWin32 HRESULT definition. It creates two HRESULT helpers to provide compatible throw behavior for existing code (PresentationCore threw things one way, other assemblies threw a different way). Also: - Remove dead interop defines (a lot) - Add Primitives test project - Force test projects to use open source key (which System.Private.Windows.Core expects) - Tweak build files a bit to try and ensure test dependencies are in place - Add strings to System.Windows.Primitives to facilitate unifying hresult handling in the future (need to redirect InvalidWmpVersionException) It would be nice to always throw the same way, but that would change exceptions that currently get thrown. Combining the behavior from both would give whatever Marshal gives with special handling for WIC/MIL errors and unwrapping of Win32 COMExceptions into Win32Exceptions. Converting the existing interop to use CsWin32 types will make transitioning far easier. The next change I'm working on is using HWND.
FYI @harshit7962 |
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.
Got through some, looks good so far. Will circle back to review the rest.
src/Microsoft.DotNet.Wpf/src/PresentationCore/MS/Win32/UnsafeNativeMethodsTablet.cs
Show resolved
Hide resolved
...rosoft.DotNet.Wpf/src/PresentationCore/MS/internal/Ink/GestureRecognizer/NativeRecognizer.cs
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.
LGTM mostly just some small style comments
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/Media/StreamAsIStream.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/dataobject.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/dataobject.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/dataobject.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/dataobject.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/AppModel/OleCmdHelper.cs
Show resolved
Hide resolved
src/Microsoft.DotNet.Wpf/src/PresentationFramework/MS/Internal/Printing/UnsafeNativeMethods.cs
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.
👍
Note that I haven't changed every instance of |
This converts to using the CsWin32 HRESULT definition. It creates two HRESULT helpers to provide compatible throw behavior for existing code (PresentationCore threw things one way, other assemblies threw a different way).
Also:
It would be nice to always throw the same way, but that would change exceptions that currently get thrown. Combining the behavior from both would give whatever Marshal gives with special handling for WIC/MIL errors and unwrapping of Win32 COMExceptions into Win32Exceptions.
Converting the existing interop to use CsWin32 types will make transitioning far easier. The next change I'm working on is using HWND.
Microsoft Reviewers: Open in CodeFlow