Autofac throwing exception due to inaccessible constructor #3686
Unanswered
Ynoaparast
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
I'm trying to add some OpenTelemetry metrics (HttpClientInstrumentation) to my .NET 6 WebApi-project but I keep bumping into an exception:
The project which throws the exception is a multitarget .NET Framework & .NET standard 2.1 class library at this location:
I noticed that the TracerProvider default constructor is protected. The current workaround for this is to explicitly register the TracerProvider in my WebApi-project using the 'Default' property which calls the constructor:
builder.Register<OpenTelemetry.Trace.TracerProvider>(x => TracerProvider.Default);
I'm not using the TracerProvider, but I assume it is a dependency somewhere down the line in the Metric code I'm using. I believe Autofac also scans my assemblies when registering types.
Beta Was this translation helpful? Give feedback.
All reactions