-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Microsoft.Extensions.DependencyInjection 2.0.0 breaks MQTTnet #93
Comments
Hi, var services = new ServiceCollection()
.AddMqttServer(options =>
{
// modify options here
})
.AddLogging()
.BuildServiceProvider();
var mqttServer = services.GetRequiredService<IMqttServer>(); @JanEggers Do we havy any chance to fix this? I found several other tickets for other projects which have the same problem because 2.0.0 of DI has a breaking change (The service provider is no longer returned as an interface). Best regards |
i will update myself then i will get that same error |
Here is an interesting post from people having the same problem: OData/WebApi#1082 |
shure we can add netstadard2.0 build with updated dependencies. pr incoming |
Well for me this not a solution because (as also discussed at the other projects which are affected) this will require all library users to use .net standard 2.0 including ASP.NET Core 2.0 and .NET 4.6+. But my goal is to still support .NET 4.5.2 and to not rely on .net core (standard) 2.0 because it is just released and I will not limit the library to only be usable by cutting edge technologies only. I am trying to use reflection for service lookup and using object as the type for the service provider field. I will let you know if this works. |
no sry i didnt put it correctly we can add another targetplatform with updated dependencies but still maintain netstandard 1.3 |
im currently working on |
Ah OK sorry I don't get that. This is surely OK for me 😄 |
i also added a new event for server started so there are no messages published in aspnetcore sample until the server is started |
I'm currently using MQTTnet in a .NET Framework 4.5.2. When I now try to update the package from 2.4 to 2.5, it is showing me dependencies like Microsoft.Extensions.DependencyInjection. Aren't these dependencies specific for .NET Core? |
@danehnert we use Microsoft.Extensions.DependencyInjection as ServiceProvider for netstandard and netfx |
im not shure why visual studio picks dotnetstandard as targetframework instead of net452 which should result in less dependencies: see #80 @chkr1011 we have 2 little issues with the nuspec, can you please verify and this should be 452 not 451 |
@danehnert These libraries are separate libraries if you use netstandard (v 1.6.1) in your screenshot. The "regular" .net Framework is a fat library with all libraries included. The new approach (decided by MS) is to split up things in separate libraries which can be maintained and released independently (most cases). So we have to accept this. Only the "Extensions" libraries are not part of the .net framework. |
@JanEggers Yes you are right. Then let us release a new version soon including the .net standard 2.0 fix. |
agreed |
@JanEggers Yes they are OK. |
il close this issue as 2.5.1 is released which also targets netstandard2.0 with updated dependencies. @danehnert im also investigating why there are more dlls added than needed that is tracked in #100 |
Still I'm having this issue. I'm targeting .NET 4.6.1, using MQTTnet 2.5.1 and upgraded to Microsoft.Extensions.DependencyInjection 2.0.0 gives me an
on doing
I'm really wondering why so many people are keen on DI. It never did anything useful for me. Only made things complicated, error prone and hard to understand (just my 2c). BTW: same problem after changing code to var svcprov = new ServiceCollection() |
I'm having the same issue, I have reverted to version 2.4 in the meantime. |
This issue is fixed in the preview version 2.5.2-rc1 (available as nuget). Please let me know if the issue is now fixed. |
For me this works with 2.5.2-rc1. Thanks! |
Package dependencies specify Microsoft.Extensions.DependencyInjection v1.1.1 or greater. But updating to Microsoft.Extensions.DependencyInjection 2.0.0 breaks MQTTnet. This statement
reproduces it.
The text was updated successfully, but these errors were encountered: