ApplicationInsights-dotnet: AI (Internal) Errors when using version 2.8.0 or 2.8.1 in Azure Functions

When using TelemetryClient in an Azure Function, AI internal errors are added in application insights. This does not occur when downgrading to 2.7.2.

Repro Steps

  1. Create a Function App with Application Insights enabled in Azure
  2. Create a queue ‘trigger-test’ in the storage account that is created with the function app
  3. Create an Azure Function in Visual Studio 2017
[FunctionName("Function1")]
public static void Run([QueueTrigger("trigger-test", Connection = "AzureWebJobsStorage")]string message, ILogger log, ExecutionContext context)
{
        var config = new ConfigurationBuilder()
	.SetBasePath(context.FunctionAppDirectory)
	.AddJsonFile("local.settings.json", true, true)
	.AddEnvironmentVariables()
	.Build();

	log.LogInformation($"Starting {message}");
	var telemetryClient = new TelemetryClient(TelemetryConfiguration.Active);
        log.LogInformation("Created tel client");
}

Project file:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netcoreapp2.1</TargetFramework>
    <AzureFunctionsVersion>v2</AzureFunctionsVersion>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.ApplicationInsights" Version="2.8.1" />
    <PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.23" />
	  <PackageReference Include="Microsoft.Azure.WebJobs" Version="3.0.0" />
	  <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.ServiceBus" Version="3.0.0" />
	  <PackageReference Include="Microsoft.Azure.WebJobs.ServiceBus" Version="2.2.0" />
	  <PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Storage" Version="3.0.0" />	
  </ItemGroup>
  <ItemGroup>
    <None Update="host.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
    </None>
    <None Update="local.settings.json">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <CopyToPublishDirectory>Never</CopyToPublishDirectory>
    </None>
  </ItemGroup>
</Project>
  1. Publish the function to the Function app
  2. Add a message to the trigger-test queue
  3. Check application insights

Actual Behavior

Traces with AI Internal Errors: AI (Internal): ERROR: Exception in Command Processing for EventSource Microsoft-ApplicationInsights-Core: An instance of EventSource with Guid 74af9f20-af6a-5582-9382-f21f674fb271 already exists. and AI (Internal): ERROR: Exception in Command Processing for EventSource Microsoft-ApplicationInsights-Core: Object reference not set to an instance of an object.

appinsights error

appinsights error 2

Expected Behavior

No AI internal errors

Version Info

Azure Function runtime version: 2.0.12134.0 (~2) .NET Version : .NET Core 2.1

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 1
  • Comments: 23 (13 by maintainers)

Commits related to this issue

Most upvoted comments

I have the same problem using Microsoft.NET.Sdk.Functions 3.0.3. How can I solve the problem for Azure Function v3?

@lmolkova

Thanks for responding and for being patient with my questions. These are good answers and i feel better about the current situation.

We’re pretty big users of Azure Functions & App Insights together and we are really looking forward to getting over that integration hump as it would improve our monitoring so much.

Thanks again.

@lmolkova AppInsights works fine, it’s just annoying that it includes all the internal errors. For now I’m using 2.7.2 in my project as a workaround.