Azure.Data.Tables - CreateTableIfNotExists throws System.NullReferenceException: 'Object reference not set to an instance of an object.'
See original GitHub issueHello, I am just writing some sample code to test the Azure.Data.Tables functionality and right away I ran into an exception.
Code is rather simple:
var serviceClient = new TableServiceClient(new Uri("<some uri>"), new TableSharedKeyCredential("<some account name>", "<some key>"));
string tableName = "TESTDATES";
TableItem table = serviceClient.CreateTableIfNotExists(tableName);
var tc = serviceClient.GetTableClient(tableName);
The first iteration, when table does not exists, it runs fine. Subsequent iterations, when table already exists, it throws an excpetion in the CreateTableIfNotExists() line.
Exceptions details:
System.NullReferenceException
HResult=0x80004003
Message=Object reference not set to an instance of an object.
Source=Azure.Core
StackTrace:
at Azure.Response1.op_Implicit(Response
1 response)
at ConsoleApp_TestingDatesInAzure.Program.Main(String[] args) in
There is no inner exception.
Thanks Herald
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (5 by maintainers)
Top Results From Across the Web
`Object reference not set to an instance of an ...
Function running the queue trigger after passing message to the queue and getting exception while sending it to the Azure Table within the...
Read more >Azure.Data.Tables 12.0.0-beta.8 - NullReferenceException ...
Describe the bug NullReferenceException in tableClient. ... NullReferenceException: Object reference not set to an instance of an object. at ...
Read more >Retrieve records from Azure Table Storage is throwing ...
As a quick look, I think new TableQuery<StringInternTableEntity>() cause the problem because it created new instance all time. Try to move it ...
Read more >TableServiceAsyncClient (Azure SDK for Java Reference ...
A TableAsyncClient instance for the table in the account with the provided tableName . Throws: IllegalArgumentException - If tableName is null or empty....
Read more >Is there any overhead of using CreateTableIfNotExists or ...
Azure.WebJobs.Extensions.Storage: Object reference not set to an instance of an object. ... Is there any need of Data Warehouse when using Azure Data...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I looked at this again and I realized that the issue is related to the implicit cast for Response<T>. The workaround for this is to either use
var
for the response type, or explicitlyResponse<TableItem>
I’ll look into a viable fix for this as well.
related to #25528
Can we synthesize an instance of TableItem and return it instead of null? It has only the Name property that we have. The T in
Response<T>
is defined as non-nullable and multiple customers have hit this issue.