From e5830664581b778603c9d29b83d4b290e2fcbb5c Mon Sep 17 00:00:00 2001 From: Vinicius Date: Wed, 23 Mar 2016 11:01:48 -0700 Subject: [PATCH] [Insights] Fix null object exception in powershell --- .../Diagnostics/GetAzureRmDiagnosticSettingCommand.cs | 10 ---------- .../Diagnostics/SetAzureRmDiagnosticSettingCommand.cs | 10 ---------- 2 files changed, 20 deletions(-) diff --git a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs index de5d6722c92f..c20951370bdc 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/GetAzureRmDiagnosticSettingCommand.cs @@ -41,16 +41,6 @@ protected override void ProcessRecordInternal() { ServiceDiagnosticSettingsGetResponse result = this.InsightsManagementClient.ServiceDiagnosticSettingsOperations.GetAsync(this.ResourceId, CancellationToken.None).Result; - if (result.Properties != null && result.Properties.Logs != null && result.Properties.Logs.Count == 0) - { - result.Properties.Logs = null; - } - - if (result.Properties != null && result.Properties.Metrics != null && result.Properties.Metrics.Count == 0) - { - result.Properties.Metrics = null; - } - PSServiceDiagnosticSettings psResult = new PSServiceDiagnosticSettings(result.Properties); WriteObject(psResult); } diff --git a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs index fa96957a452a..9df19fd20168 100644 --- a/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs +++ b/src/ResourceManager/Insights/Commands.Insights/Diagnostics/SetAzureRmDiagnosticSettingCommand.cs @@ -171,16 +171,6 @@ protected override void ProcessRecordInternal() putParameters.Properties = properties; - if (properties != null && properties.Logs != null && properties.Logs.Count == 0) - { - properties.Logs = null; - } - - if (properties != null && properties.Metrics != null && properties.Metrics.Count == 0) - { - properties.Metrics = null; - } - this.InsightsManagementClient.ServiceDiagnosticSettingsOperations.PutAsync(this.ResourceId, putParameters, CancellationToken.None).Wait(); PSServiceDiagnosticSettings psResult = new PSServiceDiagnosticSettings(putParameters.Properties); WriteObject(psResult);