-
-
Notifications
You must be signed in to change notification settings - Fork 833
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
Autofac.Extras.CommonServiceLocator doesn't work with Autofac 4.3.0+ #859
Comments
The CommonServiceLocator package, last published in 2014, itself doesn't support .NET Standard/.NET Core. There's an unofficial fork that appears to be compatible, but that's not the official one and isn't something we support. The PCL profile targeted by CommonServiceLocator looks like: Looking at the netstandard docs under the PCL compatibility section I don't see any with the I was able to create a .NET 4.5.2 app and a .NET 4.6.2 app using
and it works. I tried getting a console app targeting netcoreapp1.1 to work but you get into some odd hacky package target fallback stuff and VS starts telling me to add a reference to mscorlib 2.0.5.0 which is a weird retargetable placeholder thing used in Portable Class Libraries. Short version is: CommonServiceLocator itself doesn't really support the scenario so there's not much we can do about that. Do you have some repro where you are targeting .NET Core / .NET Standard where you didn't have to manually hack package references in and it was working? I can't find the magic combination that will fool NuGet into allowing me to even add CommonServiceLocator to a netstandard/netcoreapp project. |
@tillig Thanks for your kind explanation! So, basically it's because the CommonServiceLocator library doesn't support .NET Standard and the library is apparently not being maintained any longer. I have a toy project (Azure Functions) that relies on Autofac.Extras.CommonServiceLocator. Many of dependencies that my project is using are based on .NET Standard. If you don't mind, you can have a look at the repo and find out some workaround. |
Unfortunately I don't really have time to offer deep individualized help like that. Without even looking, though, I can tell you the replacement will be one of these:
You'll have to choose the best option for you. You might also see if you can submit a PR to CSL but if they're not maintaining it anymore that may be hard. |
@tillig Sorry for asking the individualised help. I might have misinterpreted your last paragraph:
However, your suggestion is invaluable! I'll have a look one of those options that can be applied to my situation. |
Oh, yeah, sorry for confusion. On mobile over the long holiday weekend here in the US. When I was asking for a repro I meant "a small, very simple reproduction showing a project where NuGet allowed you to somehow add the packages in the unsupported configuration" rather than "link to a repo full of projects to navigate through." Apologies for the confusion, but glad I could help. Good luck! |
Hi, Team.
Wonder if this is a known issue or not. I'm using Autofac.Extras.CommonServiceLocator 4.0.0 at my project. If I upgrade the Autofac version higher than 4.2.1, it throws an exception (
xxxx
masking intended):I tried 4.3.0, 4.4.0, 4.5.0 and 4.6.0 but all threw the same exception. Therefore I have to stay on 4.2.1 until this is fixed. Could you please let me know a workaround? I suspect that Autofac.Extras.CommonServiceLocator hasn't been updated for about a year, which resulted in failing to support .NET Standard.
Cheers,
The text was updated successfully, but these errors were encountered: