question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autofac.Extras.CommonServiceLocator doesn't work with Autofac 4.3.0+

See original GitHub issue

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):

Exception while executing function: xxxx. mscorlib: Exception has been thrown by the target of an invocation. xxxx: The type initializer for 'xxxx' threw an exception. xxxx: Method not found: 'Void Autofac.Extras.CommonServiceLocator.AutofacServiceLocator..ctor(Autofac.IComponentContext)'.

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,

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tilligcommented, Jul 4, 2017

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:

  • Use Autofac directly rather than the CSL wrapper.
  • Replace CSL with Microsoft.Extensions.DependencyInjection and Autofac.Extensions.DependencyInjection.
  • Roll your own CSL and adapt Autofac to that.
  • Use the unofficial fork of CSL that supports .NET Core and adapt Autofac to that.
  • Stop using service location to avoid the issue altogether.

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.

0reactions
tilligcommented, Jul 5, 2017

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Aliencube.Autofac.Extras.CommonServiceLocator 4.0.1
The Microsoft Enterprise Library provides a Common Service Locator for abstracting away IoC containers. .NET Standard port of this package ...
Read more >
Autofac.Extras.CommonServiceLocator 6.1.0
CommonServiceLocator. Common Service Locator implementation for Autofac. Build status. Please file issues and pull requests for this package in this repository ...
Read more >
Common Service Locator — Autofac 7.0.0 documentation
Extras.CommonServiceLocator package allows you to use Autofac as the backing store for services in places where you require Microsoft Common Service Locator ......
Read more >
nuget packages requiring net6.0 are "not compatible with ...
After booting up my PC I tried to continue using a previous project I had been working on: ASP.NET MVC Core 6.0. All...
Read more >
Package Manager Console的使用- osc_f8mjcido的个人空间
Autofac {4.9.0} Autofac is an IoC container for Microsoft .NET. It manages the dependencies between classes so that applications stay easy to... Autofac.Extras....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found