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

已经部署好的系统,已经上传了两个dome里面的插件,重启了出现问题 #35

Open
zenglei286 opened this issue Feb 29, 2024 · 1 comment
Labels
question Further information is requested

Comments

@zenglei286
Copy link

无论
PluginFinderV2 还是PluginFinderV1都出现了
protected virtual object ResolveUnregistered(Type type)
{
Exception innerException = null;
foreach (var constructor in type.GetConstructors())
{
try
{
//try to resolve constructor parameters
var parameters = constructor.GetParameters().Select(parameter =>
{
//var service = Resolve(parameter.ParameterType);
var t = type;
//var service = _serviceProvider.GetService(parameter.ParameterType);
using (var scope = _serviceScopeFactory.CreateScope())
{
var service = scope.ServiceProvider.GetService(parameter.ParameterType);
if (service == null)
throw new Exception("Unknown dependency");
return service;
}
});

         //all is ok, so create instance
         return Activator.CreateInstance(type, parameters.ToArray());
     }
     catch (Exception ex)
     {
         innerException = ex;
     }
 }

 throw new Exception("No constructor was found that had all the dependencies satisfied.", innerException);

}
这个里面的Unknown dependency 异常,上传的两个插件是HelloWorldPlugin和HexoPlugin

@yiyungent
Copy link
Owner

yiyungent commented Mar 1, 2024

这上面的 plugins 里的插件很久没维护了,建议用
https://github.com/yiyungent/KnifeHub
里最近更新的来测试,以及你用的哪个版本的?
插件引用 PluginCore 版本最好与宿主版本对上,虽然有一定程度兼容,但大版本不一定

插件里的框架引用现在推荐用下方方式,插件很多地方没更新,不过文档更新了
https://yiyungent.github.io/PluginCore/zh/PluginDev/Guide/

<FrameworkReference Include="Microsoft.AspNetCore.App">
	<ExcludeAssets>runtime</ExcludeAssets>
</FrameworkReference>

@yiyungent yiyungent added the question Further information is requested label Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants