I upgraded from azure tools 2.4 to 2.5 and now am getting a null reference thrown when I try to reference the DiagnosticMonitorConfiguration returned by DiagnosticMonitor.GetDefaultInitialConfiguration()
For example
DiagnosticMonitorConfiguration diagnosticConfig = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticConfig.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);
will throw an exception because Directories is null. From what I've googled, the default initial config is stored in the new diagnostics.wadcfgx file, which is there and looks like
<?xml version="1.0" encoding="utf-8"?>
<DiagnosticsConfiguration xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<PublicConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<WadCfg>
<DiagnosticMonitorConfiguration overallQuotaInMB="4096">
<DiagnosticInfrastructureLogs />
<Directories>
<IISLogs containerName="wad-iis-logfiles" />
</Directories>
<PerformanceCounters>
<PerformanceCounterConfiguration counterSpecifier="\Memory\Available MBytes" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\ISAPI Extension Requests/sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\Web Service(_Total)\Bytes Total/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Requests/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET Applications(__Total__)\Errors Total/Sec" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Queued" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Requests Rejected" sampleRate="PT3M" />
<PerformanceCounterConfiguration counterSpecifier="\ASP.NET\Applications Running" sampleRate="PT0S" />
</PerformanceCounters>
<WindowsEventLog scheduledTransferPeriod="PT1M">
<DataSource name="Application!*" />
</WindowsEventLog>
<Logs scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Error" />
</DiagnosticMonitorConfiguration>
</WadCfg>
<StorageAccount>mystorageaccount</StorageAccount>
</PublicConfig>
<PrivateConfig xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<StorageAccount name="assetmanagerwms" endpoint="https://core.windows.net/" />
</PrivateConfig>
<IsEnabled>true</IsEnabled>
</DiagnosticsConfiguration>
Does anybody know what I'm missing? All properties are either null or 0 on the returned DiagnosticMonitorConfiguration.
This is one of the breaking change in SDK 2.5: http://msdn.microsoft.com/en-us/library/azure/dn873976.aspx#BKMK_breaking. Essentially code based diagnostics configuration are no longer supported. From the link above: