natemcmaster / DotNetCorePlugins

.NET Core library for dynamically loading code
Apache License 2.0
1.59k stars 227 forks source link

Use of soap services in plugin throws collectible assembly exception #205

Closed bzuidgeest closed 2 years ago

bzuidgeest commented 3 years ago

I'm building an application using this pluginframework and when loading plugins I set both the EnableHotReload and IsCollectible properties to true.

This worked fine for the first few plugins, no problems.

Now I am making a new plugin that connects to a soap service. (I generated a client for this service with the WCF tooling in VS2019). When I load the plugin everything is fine, but as soon as I try to call a remote service endpoint I get an error that a non-collectible assembly cannot be call from a collectible assembly.

If I turn of the hot-reload and iscolectible properties everything works fine. I admit that this plugin stuff is a little over my head. However I did find https://github.com/dotnet/runtime/issues/1388 which to me seems to suggest that this might be a .net5 issues with the xml serializer that will get fixed with .net6.

Is there any way around this problem without turning off hot reload? Maybe I misunderstood something or there is something I missed.

natemcmaster commented 3 years ago

You will probably need to leave hot reload off. .NET itself doesn't support it and the hot-reload in this library has all sorts of sharp edges. And for what it's worth, .NET itself doesn't make building a dynamically-loaded plugin system very easy either. This library is a best-effort to workaround .NET's limitations. I'm not really sure this library can do better without .NET itself making dynamically loading and executing code a first-class thing. Until then, this library will be buggy, at best.

aloksharma1 commented 3 years ago

@natemcmaster why not make a request at net core team? dynamic loading is the way to future other languages does it so easy why not .net?

natemcmaster commented 3 years ago

They might already be working on it: https://twitter.com/davidfowl/status/1392367324586418176. But I'm not really in the loop anymore. Of course, don't wait on me to make a request to the .NET team :)

github-actions[bot] commented 2 years ago

This issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please comment if you believe this should remain open, otherwise it will be closed in 14 days. Thank you for your contributions to this project.

github-actions[bot] commented 2 years ago

Closing due to inactivity. If you are looking at this issue in the future and think it should be reopened, please make a commented here and mention natemcmaster so he sees the notification.