Azure / Azure/azure-functions-core-tools

Azure Functions Tools gives runtime error using Application Insights 2.16

Open
#2,399 10 comments 4 reactions 2 assignees Claimed by @brettsam View on GitHub
improvement
Dominant language
C#
Stars
1.5k
Forks
498
Avg merge
4d 20h
Merged PRs (30d)
14

Description

Got a very simple function to illustrate the problem:
```
[FunctionName("Function1")]
public void Run([TimerTrigger("0 */5 * * * *", RunOnStartup =true)]TimerInfo myTimer, ILogger log)
{
var requestActivity = new System.Diagnostics.Activity($"Test");
requestActivity.SetIdFormat(System.Diagnostics.ActivityIdFormat.W3C);
requestActivity.SetParentId(Guid.Empty.ToString());

using (var activity = telemetryClient.StartOperation(requestActivity))
{
}
}
```
Running that function gives this error:
**Executed 'Function1' (Failed, Id=5d9ccc3f-2e1d-4f0a-b235-6384b86ae777, Duration=4258ms)
System.Private.CoreLib: Exception while executing function: Function1. TestApp1: Method not found: 'Microsoft.ApplicationInsights.Extensibility.IOperationHolder`1 Microsoft.ApplicationInsights.TelemetryClientExtensions.StartOperation(Microsoft.ApplicationInsights.TelemetryClient, System.Diagnostics.Activity)'.**

Downgrading Application Insights to 2.15 or 2.14 solves the problem. TelemetryClient is injected.

This happens on the latest updates of VS2019 (16.8.4). What am I doing wrong here? Or is Functions Tools not compatible with AI 2.16?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.