-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[Peek] Fix ShellPreviewHandler Previewer #40111
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
Conversation
...k/Peek.FilePreviewer/Previewers/ShellPreviewHandlerPreviewer/ShellPreviewHandlerPreviewer.cs
Fixed
Show fixed
Hide fixed
...k/Peek.FilePreviewer/Previewers/ShellPreviewHandlerPreviewer/ShellPreviewHandlerPreviewer.cs
Fixed
Show fixed
Hide fixed
b21fc1a
to
13b6561
Compare
This comment has been minimized.
This comment has been minimized.
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.
Pull Request Overview
This pull request fixes the preview functionality in Peek caused by the breaking change in CsWin32 0.3.183, which modified the signature of CoGetClassObject.
- Updated CoGetClassObject call to use an out parameter of type object
- Simplified the IClassFactory retrieval by direct casting
- Validated with Office file previews in Peek
Comments suppressed due to low confidence (1)
src/modules/peek/Peek.FilePreviewer/Previewers/ShellPreviewHandlerPreviewer/ShellPreviewHandlerPreviewer.cs:101
- Directly casting pFactory to IClassFactory assumes that the returned object from CoGetClassObject supports the IClassFactory interface. Consider adding a comment or validation to clarify this assumption.
factory = (IClassFactory)pFactory;
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 for addressing this issue.
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request CsWin32 0.3.183 broke preview through preview handlers in Peek. `Error in UpdatePreviewAsync, falling back to default previewer: Unable to cast COM object of type 'System.__ComObject' to class type 'System.IntPtr'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.` Signature of `CoGetClassObject` changed for last argument from `void*` to `object`. Thanks @AArnott 🙂 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] **Closes:** #xxx - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Tested Preview of Office files in Peek.
Summary of the Pull Request
CsWin32 0.3.183 broke preview through preview handlers in Peek.
Error in UpdatePreviewAsync, falling back to default previewer: Unable to cast COM object of type 'System.__ComObject' to class type 'System.IntPtr'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
Signature of
CoGetClassObject
changed for last argument fromvoid*
toobject
.Thanks @AArnott 🙂
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed
Tested Preview of Office files in Peek.