[BUG] Azurite Table Emulator accepts ulong.MaxValue but Azure does not
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 393
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 36
Description
# Issue Transfer
This issue has been transferred from the Azure SDK for .NET repository, [#50572](https://github.com/Azure/azure-sdk-for-net/issues/50572).
### Please be aware that @bdebaere is the author of the original issue and include them for any questions or replies.
## Details
### Describe the bug
The Azure Table service data model only supports these EDM types for properties: Edm.String, Edm.Int32, Edm.Int64, Edm.Boolean, Edm.Double, Edm.DateTime, Edm.Guid, and Edm.Binary. In particular, integer properties must be stored as Edm.Int64 (mapped to C# long). Any attempt to store a value outside the signed 64-bit range (for example ulong.MaxValue) is invalid against the real service and results in a 400 Bad Request InvalidInput. However, when using the local emulator (e.g., Azurite), inserting an entity with a ulong property set to ulong.MaxValue succeeds locally, masking the issue until deployment to Azure.
```csharp
public class RowVersionEntity : ITableEntity
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public ETag ETag { get; set; }
public DateTimeOffset? Timestamp { get; set; }
public ulong RowVersion { get; set; }
}
var connectionString = "UseDevelopmentStorage=true";
var client = new TableClient(connectionString, "TestTable");
await client.CreateIfNotExistsAsync();
var entity = new RowVersionEntity
{
PartitionKey = "sourceName",
RowKey = "sourceName",
RowVersion = ulong.MaxValue,
};
// This succeeds against Azurite emulator:
await client.UpsertEntityAsync(entity);
Console.WriteLine("Local emulator accepted ulong.MaxValue.");
```
Executing the same code on Azure you receive:
```
Azure.RequestFailedException: Status: 400 (Bad Request)
ErrorCode: InvalidInput
Content:
{"odata.error":{"code":"InvalidInput","message":{"lang":"en-US","value":"An error occurred while processing this request.\n...Time:2025-06-12T09:04:25.0479682Z"}}}
```
### Expected behavior
In my opinion either the emulator must mirror Azure exactly or Azure must also support ulong. Right now you only notice this issue when deploying to Azure and the error message isn't exactly helping much.
### Actual behavior
When using the local emulator (e.g., Azurite), inserting an entity with a ulong property set to ulong.MaxValue succeeds locally, masking the issue until deployment to Azure, where it fails.
### Reproduction Steps
```csharp
public class RowVersionEntity : ITableEntity
{
public string PartitionKey { get; set; }
public string RowKey { get; set; }
public ETag ETag { get; set; }
public DateTimeOffset? Timestamp { get; set; }
public ulong RowVersion { get; set; }
}
var connectionString = "UseDevelopmentStorage=true";
var client = new TableClient(connectionString, "TestTable");
await client.CreateIfNotExistsAsync();
var entity = new RowVersionEntity
{
PartitionKey = "sourceName",
RowKey = "sourceName",
RowVersion = ulong.MaxValue,
};
// This succeeds against Azurite emulator:
await client.UpsertEntityAsync(entity);
Console.WriteLine("Local emulator accepted ulong.MaxValue.");
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.