@@ -117,8 +117,9 @@ public ArmClient GetMgmtClient() {
117117 return _armClient ;
118118 }
119119
120+ private static readonly object _corpusAccountsKey = new ( ) ; // we only need equality/hashcode
120121 public IReadOnlyList < ResourceIdentifier > CorpusAccounts ( ) {
121- return _cache . GetOrCreate < IReadOnlyList < ResourceIdentifier > > ( "CorpusAccounts" , cacheEntry => {
122+ return _cache . GetOrCreate < IReadOnlyList < ResourceIdentifier > > ( _corpusAccountsKey , cacheEntry => {
122123 var skip = GetFuncStorage ( ) ;
123124 var results = new List < ResourceIdentifier > { GetFuzzStorage ( ) } ;
124125
@@ -147,7 +148,7 @@ public IReadOnlyList<ResourceIdentifier> CorpusAccounts() {
147148
148149 _log . Info ( $ "corpus accounts: { JsonSerializer . Serialize ( results ) } ") ;
149150 return results ;
150- } ) ;
151+ } ) ! ; // NULLABLE: only this method inserts _corpusAccountsKey so it cannot be null
151152 }
152153
153154 public ResourceIdentifier GetPrimaryAccount ( StorageType storageType )
@@ -194,7 +195,7 @@ public Task<BlobServiceClient> GetBlobServiceClientForAccountName(string account
194195 var accountKey = await GetStorageAccountKey ( accountName ) ;
195196 var skc = new StorageSharedKeyCredential ( accountName , accountKey ) ;
196197 return new BlobServiceClient ( GetBlobEndpoint ( accountName ) , skc ) ;
197- } ) ;
198+ } ) ! ; // NULLABLE: only this method inserts BlobClientKey so result cannot be null
198199 }
199200
200201 sealed record TableClientKey ( string AccountName ) ;
@@ -204,7 +205,7 @@ public Task<TableServiceClient> GetTableServiceClientForAccountName(string accou
204205 var accountKey = await GetStorageAccountKey ( accountName ) ;
205206 var skc = new TableSharedKeyCredential ( accountName , accountKey ) ;
206207 return new TableServiceClient ( GetTableEndpoint ( accountName ) , skc ) ;
207- } ) ;
208+ } ) ! ; // NULLABLE: only this method inserts TableClientKey so result cannot be null
208209
209210 sealed record QueueClientKey ( string AccountName ) ;
210211 private static readonly QueueClientOptions _queueClientOptions = new ( ) { MessageEncoding = QueueMessageEncoding . Base64 } ;
@@ -214,5 +215,5 @@ public Task<QueueServiceClient> GetQueueServiceClientForAccountName(string accou
214215 var accountKey = await GetStorageAccountKey ( accountName ) ;
215216 var skc = new StorageSharedKeyCredential ( accountName , accountKey ) ;
216217 return new QueueServiceClient ( GetQueueEndpoint ( accountName ) , skc , _queueClientOptions ) ;
217- } ) ;
218+ } ) ! ; // NULLABLE: only this method inserts QueueClientKey so result cannot be null
218219}
0 commit comments