Skip to content
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

.Net 6 Isolated Function: Unable to resolve service for type 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' while attempting to activate function #8043

Closed
willyt150 opened this issue Jan 8, 2022 · 3 comments

Comments

@willyt150
Copy link

Is your question related to a specific version? If so, please specify:

V4 .Net 6 Isolated

What language does your question apply to? (e.g. C#, JavaScript, Java, All)

C#

Question

I've created a .Net 6 Isolated HttpTriggered function in Visual Studio 2022

I'm trying to get the TelemetryConfiguration injected, and based on other issues logged and docs this should NOT be null once my local.settings.json has a value for APPINSIGHTS_INSTRUMENTATIONKEY

However, that isn't the case when running locally.

Is there a new way to access it in .Net 6 isolated? Cause this works just fine in my .Net 3.1 functions.

Thanks for your time!

@ghost ghost assigned kshyju Jan 8, 2022
@willyt150 willyt150 changed the title Unable to resolve service for type 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' while attempting to activate function .Net 6 Isolated Function: Unable to resolve service for type 'Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration' while attempting to activate function Jan 8, 2022
@v-bbalaiagar v-bbalaiagar self-assigned this Jan 10, 2022
@v-bbalaiagar
Copy link

Hi @willyt150 , Thank you for your feedback!
Hi @brettsam , Could you please take a look at this issue.

@lommez
Copy link

lommez commented Jan 14, 2022

@willyt150,

The documentation is wrong.
The right way to inject TelemetryConfiguration is using IOptions interface, like this:

IOptions

@willyt150
Copy link
Author

willyt150 commented Jan 15, 2022

thanks @lommez

your example is missing the actual implementation, but I'm familiar with the IOptions, so you pointed me in the correct direction. Thank you again!

so @v-bbalaiagar my issue has been solved, but the docs just need to be updated calling out how to properly retrieve the injected telemetry configuration.

@ghost ghost locked as resolved and limited conversation to collaborators Feb 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants