Rory
Rory

Reputation: 41817

AzureDiagnostics crashing with System.ArgumentException: An item with the same key has already been added

In a recent deploy of our Cloud Service I'm getting lots of errors in my Application Event Log. Presumably it's a combination of us misconfiguring something in Azure Diagnostics and Azure Diagnostics being unable to deal with it gracefully. But what specifically is misconfigured?

Every 5 minutes I get this:

First Error with Source=AzureDiagnostics

System.ArgumentException: An item with the same key has already been added.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at ApplicationInsightsExtension.WindowsEventLogPublisher..ctor(ILogger logger, ITelemetryClient client, String logTablesPath, IEnumerable`1 dataSources, ILocalTableReader tableReader, Dictionary`2 configProperties) in x:\bt\725234\repo\src\agent\extensions\AppInsightsExtension\Publishers\WindowsEventLogPublisher.cs:line 59
   at ApplicationInsightsExtension.WAD2AIExtension.GetPublishersBasedOnConfig() in x:\bt\725234\repo\src\agent\extensions\AppInsightsExtension\WAD2AIExtension.cs:line 114
   at ApplicationInsightsExtension.Program.Main(String[] args) in x:\bt\725234\repo\src\agent\extensions\AppInsightsExtension\Program.cs:line 43

Then Error Source=.NET Runtime

Application: ApplicationInsightsExtension.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.ArgumentException
Stack:
   at ApplicationInsightsExtension.Program.Main(System.String[])

Then Error with Source=Application Error

Faulting application name: ApplicationInsightsExtension.exe, version: 33.3.11.0, time stamp: 0x57224d6d
Faulting module name: KERNELBASE.dll, version: 6.3.9600.18202, time stamp: 0x569e7eb1
Exception code: 0xe0434352
Fault offset: 0x0000000000008a5c
Faulting process id: 0x1504
Faulting application start time: 0x01d1bcb0c4a62a77
Faulting application path: C:\Resources\directory\403a5550e74e40448af87aa6c4d6183a.OUR.APP.NAME.DiagnosticStore\WAD0106\Package\Ext\ApplicationInsightsExtension\Commit\ApplicationInsightsExtension.exe
Faulting module path: D:\Windows\system32\KERNELBASE.dll
Report Id: 02a628df-28a4-11e6-80c2-00155dc05ef6
Faulting package full name: 
Faulting package-relative application ID: 

Upvotes: 2

Views: 246

Answers (1)

Rory
Rory

Reputation: 41817

Looks like the problem was in my Diagnostics Configuration > Windows Event Logs. I had both System!* ticked and also System![System[(Level = 1 or Level=2)]]. D'oh.

I still get the odd other error like this, but doesn't seem important.

System.NullReferenceException: Object reference not set to an instance of an object.
   at Microsoft.Azure.Plugins.Diagnostics.dll.RoleInformation.get_IsWorkerRole()

Upvotes: 2

Related Questions