azure-functions-core-tools
azure-functions-core-tools copied to clipboard
Azure Functions Tools gives runtime error using Application Insights 2.16
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<Microsoft.ApplicationInsights.DataContracts.DependencyTelemetry>(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<!!0> 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?
@brettsam could you please take a look at this?
@brettsam double checking, but this looks like a breaking change in 2.16
any update on this? seems it's quite brittle when using different nuget package versions than included in runtime, are there any best practice setting up dependency injection?
I'm having the same issue and I had to downgrade application insights version and suppress version downgrade errors. Any update on this?
@CarlosLanderas I tried downgrading as well but it didn't work. Which version did you downgrade to?
@vyarymovych 2.14 is working properly I'm now able to do distributed tracing by starting operations using System.Diagnostics.Activity
@CarlosLanderas thanks, I just tried again and still the same error. Sending the package versions that I use
2.17 is also broken. Reverting to 2.14 does work
Faced the same issue upgrading to v2.18. Reverting to v2.14 works.
Is this issue expected to be fixed now with Azure/azure-functions-host/pull/8041 merged?