-
Notifications
You must be signed in to change notification settings - Fork 19
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
Add Plugin Support to dynamically load BLE Adapters #171
Conversation
- Enable usage of Configuration JSON file / command line input - Add Plugin Infrastructure for BLE adapters for CLIs - Enable VS Code Debugger to run .NET 5 builds - Add CliBase project to unify DI container creation for CLI projects - Rewrote SharpBrick.PoweredUp.WinRT/BlueGigaBLE into plugins and dereference from Examples and CLI - Add selection by command line of execute example #155 non-breaking
@dkurok Can you have a look into this? It is basically - for the generic purpose CLIs - a plugin infrastructure which loads the adapters from a sub folder using a configuration parameter (either using JSON or command line Just watchout, this is still a draft. I have not written yet the steps to publish the WinRT/BlueGiga as plugins (it is basically a |
@tthiery I've looked over the changes and that looks promising and a good idea. I looked some promising issues on the internet about this error, especially https://stackoverflow.com/questions/948785/typeloadexception-says-no-implementation-but-it-is-implemented Did you get it running with WinRT ? If yes, what is your build-order / copy-order? Another question: is the targetFramework "netstandard2.1" in the kernel-project (SharpBrick.PoweredUp) really needed anymore? Same for SharpBrick.PoweredUp.Mobile - there it is ONLY netstandard2.1. AFAIK "net5.0" would be enough; in .NET 5 there is no more ".NET standard x.y" Did you try with a JSON-file instead of commandline-args? Can you checkin an example (not clear about the nesting of the options for e.g. the BlueGiga; couldn't really try because I'm not getting so far.... |
Addon: Is it maybe a problem with VS Studio 2019 vs. VS Code? |
I run exclusively VS Code with the C# extensions. But that should not be the case of the editor. What I did was that I run a |
Regards netstandard2.1: Yes, it is needed. I removed it but the Xamarin adapter needs it. Xamarin is not yet on net5.0 and will only arrive there with net6.0 => netstandard2.1 for them. We will fix this in November. |
Regards the TypeLoad: That is most likely a c&p order thingy. build it completely. dotnet publish the bluegiga one and then copy it over. Yes WinRT works and I think I also tested BlueGigaBLE to the extend that it loaded. |
Regards {
"EnableTrace": true,
"BluetoothAdapter": "BlueGigaBLE",
"COMPortName": "COM4",
"TraceDebug": true
} I have not stacked them (yet) because I do not know the behavior of the command line parsing in case it is nested. |
@dkurok I figured out your "not implemented" problem (and also the poweredup.json problem). The plugin copied its own set of dlls (e.g. folder "Host" Microsoft.Extensions.Logging with IConfiguration and plugin folder "BlueGigaBLE" Microsoft.Extensions.Logging with IConfiguration). And the core lib was already not included in the plugin by provided by the host, the two IConfiguration did not longer match => Interface was not implemented by Type. I could fix that by deleting files from the plugin. However, then |
I am currently not in favor of this solution. The packaging effort of the plugins into the various other projects makes it incredible hard to understand for a beginner. I work on an alternative, but the user-friendliness vs. maintainer effort is a nightmare |
I have decided to close this Pull Request due to the maintenance burden it implies. I will create a simpler, less automatic approach in #172. |
dereference from Examples and CLI
Closes #155 non-breaking