Skip to content

Commit 0fc3761

Browse files
authored
[OperationalInsights] bug fix - PSStorageInsight failed on null value of containers and tables (Azure#16860)
* fixed a bug that caused an exception when creating PSStorageInsight object * removed commentns and added null check * changelog update
1 parent 64633da commit 0fc3761

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

src/OperationalInsights/OperationalInsights/ChangeLog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
- Additional information about change #1
1919
-->
2020
## Upcoming Release
21+
* Bug fix - prevent exceptions while using StorageInsight cmdlets
2122

2223
## Version 3.0.0
2324
* Expanded DataSourceType with values `Query`, `Alerts` for LinkedStorageAccount cmdlets

src/OperationalInsights/OperationalInsights/Models/PSStorageInsight.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public PSStorageInsight(StorageInsight storageInsight, string resourceGroupName,
3737
this.Type = storageInsight.Type;
3838
this.StorageAccountResourceId = storageInsight.StorageAccount?.Id;
3939
this.StorageAccountKey = storageInsight.StorageAccount?.Key;
40-
this.Tables = storageInsight.Tables.ToList();
41-
this.Containers = storageInsight.Containers.ToList();
40+
this.Tables = storageInsight.Tables?.ToList();
41+
this.Containers = storageInsight.Containers?.ToList();
4242
this.State = storageInsight.Status?.State;
4343
this.StateDescription = storageInsight.Status?.Description;
4444
this.ETag = storageInsight.ETag;
@@ -53,22 +53,22 @@ public PSStorageInsight(StorageInsight storageInsight, string resourceGroupName,
5353

5454
public string WorkspaceName { get; set; }
5555

56-
public string Type { get; set; }//added
56+
public string Type { get; set; }
5757

5858
public string StorageAccountResourceId { get; set; }
5959

60-
public string StorageAccountKey { get; set; }// new prop
60+
public string StorageAccountKey { get; set; }
6161

6262
public string State { get; set; }
6363

64-
public string StateDescription { get; set; }//new prop
64+
public string StateDescription { get; set; }
6565

6666
public List<string> Tables { get; set; }
6767

6868
public List<string> Containers { get; set; }
6969

70-
public Hashtable Tags { get; set; } //new prop
70+
public Hashtable Tags { get; set; }
7171

72-
public string ETag { get; set; }//new prop
72+
public string ETag { get; set; }
7373
}
7474
}

0 commit comments

Comments
 (0)