aspnet / WebHooks

[Archived] Libraries to create and consume web hooks on ASP.NET Core. Project moved to https://github.com/aspnet/AspLabs
Apache License 2.0
627 stars 439 forks source link

Issue with having Webhooks and 2.0 version of DependencyInjection in same project #229

Closed rsvaidya closed 6 years ago

rsvaidya commented 6 years ago

Hi,

Microsoft.AspNet.WebHooks.Custom.AzureStorage.dll has a dependency on 1.0 version of Microsoft.Extensions.DependencyInjection.dll.

In our application we have a hard dependency on 2.0 version of Microsoft.Extensions.DependencyInjection. Because of this we get the following exception:

System.MissingMethodException: Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'. at Microsoft.AspNet.WebHooks.DataSecurity.GetDataProtector() at System.Web.Http.HttpConfigurationExtensions.InitializeCustomWebHooksAzureStorage(HttpConfiguration config, Boolean encryptData)

Other frameworks also seem to have similar issues. See https://github.com/dotnet/orleans/issues/3325. We raised this issue on the DependencyInjection repo first and the suggestion is to recompile WebHooks with 2.0 version of DependencyInjection. See https://github.com/aspnet/Home/issues/2788.

What is the best way to solve this problem?

Thanks, Raghavendra

dougbu commented 6 years ago

Please move this issue to the aspnet/AspNetWebHooks repo. We just separated ASP.NET WebHooks from AS.NET Core WebHooks and the former now lives in that repo. (Will update the Readme files soon.)

Unfortunately, fixing this issue won't be as simple as "recompiling WebHooks with 2.0 version of DependencyInjection". Will likely need to bump the target framework of the Microsoft.AspNet.WebHooks.Custom.AzureStorage and Microsoft.AspNet.WebHooks.Custom.SqlStorage packages to .NET Framework 4.6.1. (The newer DependencyInjection package targets .NET Standard 2.0, not the current .NET Standard 1.1.) That's a breaking change.

Could target both .NET Framework 4.5 and 4.6.1 (with different DependencyInjection versions) in those projects. But, I'd prefer we avoid the multi-targeting complications. Is 4.6.1 is sufficient for everyone likely to upgrade their Microsoft.AspNet.WebHooks.Custom.AzureStorage or Microsoft.AspNet.WebHooks.Custom.SqlStorage dependencies?

dougbu commented 6 years ago

By the way, are you using WebHooks sender or receiver packages in your application? I'm wondering if the ASP.NET Core WebHooks packages would be a better choice for your scenario.

rsvaidya commented 6 years ago

this issue has been moved to aspnet/AspNetWebHooks repo.