lin-ycv / EverythingPowerToys

Everything search plugin for PowerToys Run
Eclipse Public License 2.0
2.34k stars 61 forks source link

[BUG] Failed to Load Everything Plugin #13

Closed PakerYu closed 2 years ago

PakerYu commented 2 years ago

Describe the bug The Everything plugin cannot be loaded by PowerToys. When I reboot PT or turn on the Everything plugin individually in PT, it reports "Fail to Load Everythin Plugin".

To Reproduce Steps to reproduce the behavior:

  1. Go to the interface of PowerToys Run.
  2. Turn the "Everything" switch on.

Screenshots 图片

Logs [2022-05-11 12:42:48.7596] [ERROR] [C:\a_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::204] -------------------------- Begin exception -------------------------- Message: Fail to Init plugin: Everything

Exception full name : System.TypeInitializationException Exception message : The type initializer for 'Community.PowerToys.Run.Plugin.Everything.NativeMethods' threw an exception. Exception stack trace: at Community.PowerToys.Run.Plugin.Everything.NativeMethods.EverythingSetup() at Community.PowerToys.Run.Plugin.Everything.Main.Init(PluginInitContext context) at Wox.Plugin.PluginPair.InitPlugin(IPublicAPI api) Exception source : Community.PowerToys.Run.Plugin.Everything Exception target site: Void EverythingSetup() Exception HResult : -2146233036

Exception full name : System.IndexOutOfRangeException Exception message : Index was outside the bounds of the array. Exception stack trace: at Community.PowerToys.Run.Plugin.Everything.NativeMethods.GetFileTypeAndIcon() at Community.PowerToys.Run.Plugin.Everything.NativeMethods..cctor() Exception source : Community.PowerToys.Run.Plugin.Everything Exception target site: System.Collections.Hashtable GetFileTypeAndIcon() Exception HResult : -2146233080 -------------------------- End exception --------------------------

Version (please provide the version of software you are using):

lin-ycv commented 2 years ago

I'm not able to reproduce this on win10, I'm guessing it's a win11 issue. I'll come back to this after I've set up a win11 vm

lin-ycv commented 2 years ago

@PakerYu could you test using an older version of this plugin and let me know if it still throws errors? Try this one: https://github.com/lin-ycv/EverythingPowerToys/releases/tag/v0.2.0

PakerYu commented 2 years ago

@PakerYu could you test using an older version of this plugin and let me know if it still throws errors? Try this one: https://github.com/lin-ycv/EverythingPowerToys/releases/tag/v0.2.0

@lin-ycv Thanks for your attention! I tried the version 0.2.0 as you suggested, and I also tried the another version v0.56.2 - .NET 6. Both versions worked well, there are no exceptions for this plugin in log file.

lin-ycv commented 2 years ago

@PakerYu Can you please use this debug version of the plugin and upload the debugLog.txt it creates in the Documents folder Everything0580-DEBUG.zip

Inside that log file it should look something like

EverythingSetup Started
FlagsSet
Reading Custom Settings
# This is the settings file to override the behaviour for "Everything for PowerToys"
# to override a setting, uncomment that line by uncommenting and changing the value
# ie: "# max = 20" -> "max = 10"

# Set max amount of results to return [default: 20]
# max = 20

# Set result sorting method [default: 14]
# https://www.voidtools.com/support/everything/sdk/everything_getsort/
# sort = 14

# There are no more override options
# Restart of powertoys is needed if values are changed
Custom FIN

Get Icons
Got Keys: 6917

rkFileType : HKEY_CLASSES_ROOT\.appcontent-ms
defaultValue : ApplicationContent
Default : NULL
Program : HKEY_CLASSES_ROOT\ApplicationContent\shell\Open\command
System.NullReferenceException: Object reference not set to an instance of an object.
   at Community.PowerToys.Run.Plugin.Everything.NativeMethods.GetFileTypeAndIcon()
PakerYu commented 2 years ago

@lin-ycv I installed the debug version, and after I launched PT, it still says "Fail to load Everything Plugin". According to your instructions, this is the contents of the log file:


EverythingSetup Started
FlagsSet
Reading Custom Settings
# This is the settings file to override the behaviour for "Everything for PowerToys"
# to override a setting, uncomment that line by uncommenting and changing the value
# ie: "# max = 20" -> "max = 10"

# Set max amount of results to return [default: 20]
# max = 20

# Set result sorting method [default: 14]
# https://www.voidtools.com/support/everything/sdk/everything_getsort/
# sort = 14

# There are no more override options
# Restart of powertoys is needed if values are changed
Custom FIN

Get Icons
Got Keys: 9444
nrkFileType : HKEY_CLASSES_ROOT\.drp
defaultValue : DsgnChkRptView.Document
Default : NULL
Program : 
value length : 0

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Community.PowerToys.Run.Plugin.Everything.NativeMethods.GetFileTypeAndIcon()
lin-ycv commented 2 years ago

@PakerYu Please do the following to provide more information:

  1. Open Registry Editor
  2. Navigate to Computer\HKEY_CLASSES_ROOT\DsgnChkRptView.Document
  3. Check if it has the key DefaultIcon and/or shell\open\command 4a. if the folders exist, please provide a screenshot with that key selected (one for each if both exists), like this: image image 4b. if the folders don't exist, please provide a screenshot of DsgnChkRptView.Document, something like this: image

What seems to be happening is that you have a registered extension type .drp, but no registered program to open it, so it failed to get the values for that extension type, I was sure I had logic to handled this issue, but apparently not. It's interesting that 0.56.2 works for you, since I don't remember changing the logic between 0.56.2 and 0.58.0, but that's fine, I'll take a closer look after you've provided the screenshots

PakerYu commented 2 years ago

@lin-ycv In my registry, it doesn't have the key DefaultIcon: 图片

And I found shell\open\command: 图片

lin-ycv commented 2 years ago

@PakerYu it should be fixed in the revision 1 of v0.58.0 - Custom settings. if it still doesn't work, please reopen the issue and let me know.

lin-ycv commented 2 years ago

@PakerYu Would you be willing to test a WIP version? Someone else encountered a similar issue #16 , I want to make sure it the new solution doesn't break anything for you. the WIP version is here

PakerYu commented 2 years ago

@PakerYu Would you be willing to test a WIP version? Someone else encountered a similar issue #16 , I want to make sure it the new solution doesn't break anything for you. the WIP version is here

Thanks, I tried the WIP version, and it works well. There are no related exceptions in the log file.