Skip to content
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

PowerToys Run will not load plugin's depencies dll #18435

Closed
1 task done
ohroy opened this issue May 23, 2022 · 9 comments
Closed
1 task done

PowerToys Run will not load plugin's depencies dll #18435

ohroy opened this issue May 23, 2022 · 9 comments
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@ohroy
Copy link

ohroy commented May 23, 2022

Microsoft PowerToys version

0.58.0

Running as admin

  • Yes

Area(s) with issue?

PowerToys Run

Steps to reproduce

build a plugin with 3rd depency like Newtonsoft.Json, build the plugin and put both plugin.dll and Newtonsoft.Json.dll to plugin dir.

then, restart , see logs

[2022-05-23 21:06:55.1710] [ERROR] [C:\a\_work\1\s\src\modules\launcher\Wox.Plugin\PluginPair.cs::204]
-------------------------- Begin exception --------------------------
Message: Fail to Init plugin: Dictionary

Exception full name  : System.IO.FileNotFoundException
Exception message    : Could not load file or assembly 'Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'. 系统找不到指定的文件。
Exception stack trace:
   at PowerToys.Launcher.Plugin.Dictionary.Main.Init(PluginInitContext context)
   at Wox.Plugin.PluginPair.InitPlugin(IPublicAPI api)
Exception source     : PowerToys.Launcher.Plugin.Dictionary
Exception target site: Void Init(Wox.Plugin.PluginInitContext)
Exception HResult    : -2147024894
-------------------------- End exception --------------------------

✔️ Expected Behavior

the plugin can load its depencies

❌ Actual Behavior

the plugin will not load its depencies

Other Software

No response

@ohroy ohroy added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels May 23, 2022
@ohroy
Copy link
Author

ohroy commented May 23, 2022

_assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(Metadata.ExecuteFilePath);

I found the relevant code, which does not resolve dependencies layer by layer....

It seems that the plugin system still has a long way to go

@htcfreek
Copy link
Collaborator

/bugreport

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels May 23, 2022
@ghost
Copy link

ghost commented May 23, 2022

Hi there!

We need a bit more information to really debug this issue. Can you add a "Report Bug" zip file here? You right click on our system tray icon and just go to report bug. Then drag the zipfile from your desktop onto the GitHub comment box in this issue. Thanks!
Report Bug

@ohroy
Copy link
Author

ohroy commented May 23, 2022

#18437
fixed it

@ghost ghost added Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Needs-Team-Response An issue author responded so the team needs to follow up and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels May 23, 2022
@htcfreek
Copy link
Collaborator

htcfreek commented May 23, 2022

Can't you switch to System.Text.Json? Then we don't have the dependency.

@htcfreek
Copy link
Collaborator

@rozbo
Can you please update your namespace to Community.PowerToys.Run.Plugin.xyz.

There was an internal decision that this is the way we want to go with community plugins. (@crutkas please correct me if this is wrong. If not we should create a hint in our readme.)

@ohroy
Copy link
Author

ohroy commented May 24, 2022

Of course I can easily switch to System.Text.Json, but in the actual environment, plugins always have various dependencies, unless it is really a toy,load the dependency of plugin is inevitable, so we need to fundamentally solve this problem, not bypass it.

I will change the plugin's name to Community.PowerToys.Run.Plugin.X

@crutkas
Copy link
Member

crutkas commented May 24, 2022

@htcfreek they are proposing the correct solution here. We want clear distinction for our codebase what is and is not community. If someone loads a 3rd party plugin, they can use whatever namespace

@crutkas crutkas added Idea-Enhancement New feature or request on an existing product Status-In progress This issue or work-item is under development and removed Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Needs-Team-Response An issue author responded so the team needs to follow up labels May 24, 2022
@stefansjfw stefansjfw added Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release. and removed Status-In progress This issue or work-item is under development labels Dec 26, 2023
@jaimecbernardo
Copy link
Collaborator

This has been worked on during the 0.77 Release sprint. Please update PowerToys to the latest release: https://github.com/microsoft/PowerToys/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Idea-Enhancement New feature or request on an existing product Product-PowerToys Run Improved app launch PT Run (Win+R) Window Resolution-Fix Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

No branches or pull requests

5 participants