Reputation: 17377
I have an import process that takes data from an old source and puts it into table storage, which allows me to re-init table storage and start over as needed. It was working prior to updating to the October Azure SDK for .NET (VS2012). Now, it fails after inserting a few entities (it seems to vary, the imported data is not static in nature). The first entity, of the same type, always inserts successfully. The partition keys are unique, and the RowKey for each is an empty string (not null). It is failing specifically on SaveChangesWithRetries()
. Are there any changes in the new SDK that would be incompatible with what I was doing before?
Update
I've been inspecting the actual XML of successfully inserted rows by querying the table storage database. One thing I noticed is that a nullable int column on the entity has SqlType nvarchar(max)
when it's null, and int
when it's not null. Is this intended?
Upvotes: 3
Views: 943
Reputation: 389
This issue has been fixed in later versions of the Windows Azure SDK. Install the latest version to fix the problem. http://www.windowsazure.com/en-us/downloads/
Upvotes: 1
Reputation: 17377
So, I've been able to successfully reproduce the error on a consistent basis, and it turns out that it's a pretty nasty bug introduced in the October 2012 SDK.
Any string ending with a space will cause the exception to be thrown. Calling Trim() on all string inputs has solved this issue.
Upvotes: 8
Reputation: 24895
This is clearly one of the issues with the emulator. As you might know, it simulates Table Storage in SQL Server. This works in most cases, but when you try to do something special like adding extra properties or in your case simply mix nullable and not nullable values in a property things tend to go bad.
This page explains the differences between the actual Table Storage service and the implementation in the emulator. But your issue doesn't seem to be documented just yet. You'll find many reports of issues with the Table Storage emulator (also here on StackOverflow).
The only solution for you is to develop with a real storage account instead of using the emulator.
Upvotes: 1