microsoft / PowerToys

Windows system utilities to maximize productivity
MIT License
111.64k stars 6.57k forks source link

PowerToys Run: OneNote plugin not loading #19418

Open Thallerich opened 2 years ago

Thallerich commented 2 years ago

Microsoft PowerToys version

0.60.1

Running as admin

Area(s) with issue?

PowerToys Run

Steps to reproduce

OneNote Plugin is not loading. Immediately after turning on the OneNote Plugin the error message pops up: image

Bug Report: PowerToysReport_2022-07-14-07-38-16.zip

✔️ Expected Behavior

No response

❌ Actual Behavior

No response

Other Software

No response

htcfreek commented 2 years ago

@Thallerich Thank you for reporting this. Which version of OneNote do you have installed? The version that comes with MS Office or only the one that comes with Windows 10?

htcfreek commented 2 years ago
[2022-07-14 07:29:37.4493] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::200]
-------------------------- Begin exception --------------------------
Message: Fail to Init plugin: OneNote

Exception full name  : System.InvalidCastException
Exception message    : Unable to cast COM object of type 'Microsoft.Office.Interop.OneNote.ApplicationClass' to interface type 'Microsoft.Office.Interop.OneNote.IApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{452AC71A-B655-4967-A208-A4CC39DD7949}' failed due to the following error: Interface not registered (0x80040155).
Exception stack trace:
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Office.Interop.OneNote.ApplicationClass.GetHierarchy(String bstrStartNodeID, HierarchyScope hsScope, String& pbstrHierarchyXmlOut, XMLSchema xsSchema)
   at ScipBe.Common.Office.OneNote.OneNoteProvider.<>c.<get_PageItems>b__3_0(Application oneNote)
   at ScipBe.Common.Office.OneNote.OneNoteProvider.CallOneNoteSafely[T](Func`2 action)
   at ScipBe.Common.Office.OneNote.OneNoteProvider.get_PageItems()
   at Microsoft.PowerToys.Run.Plugin.OneNote.Main.Init(PluginInitContext context)
   at Wox.Plugin.PluginPair.InitPlugin(IPublicAPI api)
Exception source     : System.Private.CoreLib
Exception target site: IntPtr GetCOMIPFromRCW(System.Object, IntPtr, IntPtr ByRef, Boolean ByRef)
Exception HResult    : -2147467262
-------------------------- End exception --------------------------
Thallerich commented 2 years ago

The one coming with office, install is "Microsoft 365 apps for enterprise", monthly enterprise channel version 2205 (Build 15225.20356) image

htcfreek commented 2 years ago

@palenshus Incompatible OneNote version or bug in plugin code? If it's a compatibility thing we should show an error message instead of crashing.

RTM13 commented 2 years ago

I had this same problem in build 2209 of the Microsoft 365 version, and fixed it by doing a Quick Repair of that from Windows Settings.

[2022-07-14 07:29:37.4493] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::200]
-------------------------- Begin exception --------------------------
Message: Fail to Init plugin: OneNote

Exception full name  : System.InvalidCastException
Exception message    : Unable to cast COM object of type 'Microsoft.Office.Interop.OneNote.ApplicationClass' to interface type 'Microsoft.Office.Interop.OneNote.IApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{452AC71A-B655-4967-A208-A4CC39DD7949}' failed due to the following error: Interface not registered (0x80040155).
Exception stack trace:
   at System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
   at Microsoft.Office.Interop.OneNote.ApplicationClass.GetHierarchy(String bstrStartNodeID, HierarchyScope hsScope, String& pbstrHierarchyXmlOut, XMLSchema xsSchema)
   at ScipBe.Common.Office.OneNote.OneNoteProvider.<>c.<get_PageItems>b__3_0(Application oneNote)
   at ScipBe.Common.Office.OneNote.OneNoteProvider.CallOneNoteSafely[T](Func`2 action)
   at ScipBe.Common.Office.OneNote.OneNoteProvider.get_PageItems()
   at Microsoft.PowerToys.Run.Plugin.OneNote.Main.Init(PluginInitContext context)
   at Wox.Plugin.PluginPair.InitPlugin(IPublicAPI api)
Exception source     : System.Private.CoreLib
Exception target site: IntPtr GetCOMIPFromRCW(System.Object, IntPtr, IntPtr ByRef, Boolean ByRef)
Exception HResult    : -2147467262
-------------------------- End exception --------------------------
palenshus commented 2 years ago

Any word @Thallerich if that solves your issue too? @htcfreek, in cases where you don't have OneNote or the wrong version of it, it shouldn't crash, this one is something different. We could add an addition catch for InvalidCastException, but that would render the plugin unusable w/o providing any indication that something is wrong, it's probably good that it crashed so we're alerted to it

Thallerich commented 2 years ago

Nope sorry, still have the problem. Neither a repair nor a complete reinstall helped. I am now on an insider build, still getting the error. image

It's probably a weird configuration on my machine. I guess we can close this and i'll just live without the plugin. :)

htcfreek commented 2 years ago

@Thallerich What I see is that you have Microsoft 365 OneNote (OneClick-Installer). Not sure if this is supported by the plugin.

RTM13 commented 2 years ago

Mine is also the Microsoft 365 edition, though a normal build. So the issue shouldn't have anything to do with that.

image

I also have the Windows App version installed, and I had feared that it was some interference between the two versions that was causing my problem, but the Quick Repair fixing the issue for me has disproved that.

I hope you can find a solution.

palenshus commented 2 years ago

Under the covers, the plugin just uses the https://github.com/scipbe/ScipBe-Common-Office library for actual OneNote interop. Can you try out this LINQPad script and see if it returns any results?

Thallerich commented 2 years ago

Nope, also getting this error when running that script. Unable to cast COM object of type 'Microsoft.Office.Interop.OneNote.ApplicationClass' to interface type 'Microsoft.Office.Interop.OneNote.IApplication'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{452AC71A-B655-4967-A208-A4CC39DD7949}' failed due to the following error: Interface not registered (0x80040155).

It's most likely something with my office install or my pc configuration, since an office repair does not help.

ethanfangg commented 4 months ago

is this still an issue in the latest update? /needinfo

Thallerich commented 4 months ago

Yes, i do still have this problem.