views:

479

answers:

1

Cross-posted at MSDN.

I have a list of entity objects I'm trying to insert into a table in the local storage service. Using a data context class derived from the SampleClient TableStorageDataContext class, I create a new context object and add the entities with no issues. When I call context.SaveChanges(), an exception is ultimately thrown, but with sparingly little detail. I've run a profiler trace on SQL Server Express to see if the error originated there, and didn't find anything useful, which leads me to believe there's some issue in the local storage service, which I have no idea how to debug.

Here's the client code (F#):

let cxt0 = new WebRole.Models.TableDataContext()
entityList |> Seq.iter (fun n -> cxt0.AddObject("NutritionData", n))
let results = cxt0.SaveChanges()

I can set a breakpoint on the last of the above lines and stop execution and see that the cxt0 object contains all the entities to be added (>500K). After then continuing execution, the following exception is thrown:

System.Data.Services.Client.DataServiceRequestException: "An error occurred while processing this request."

at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.HandleBatchResponse() at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.EndRequest() at System.Data.Services.Client.DataServiceContext.SaveChanges(SaveChangesOptions options) at System.Data.Services.Client.DataServiceContext.SaveChanges() at WorkerRole.SrDataProcessor.importSrData(FastFunc`2 pf, String blobName) in C:\Users\Ben\Development\Projects\CloudProject\WorkerRole\SrDataProcessor.fs:line 76

The InnerException (pardon the brackets as I avoid the html tag scrubber):

System.Data.Services.Client.DataServiceClientException: " [?xml version="1.0" encoding="utf-8" standalone="yes"?] [error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata"] [code][/code] [message xml:lang="en-US"]An error occurred while processing this request.[/message] [/error] "

at System.Data.Services.Client.DataServiceContext.SaveAsyncResult.d__1d.MoveNext()

In the HandleBatchResponse method, it appears that this error may be reported as it enumerates through the responses. Any ideas what might be calling this? The only thing left I've thought to check but haven't is to ensure that none of my entities have string properties that go past 1000 characters.

Update: Now I have, and it doesn't look like there are any. The following snippet produced an empty sequence:

let longEntities = 
    nutData |> Seq.choose (fun nd -> if HasLongStringProperties(nd)
                                     then Some(nd) else None)

Also, more generally, how does one debug issues like this? Is there any way to get some introspection into the local storage service?

Update 2: I've since discovered that the "exception of origin", so to speak, is actually a System.WebException reporting an "Internal Server Error (500)", with no further detail. I've done everything I know to do to ensure that the data I'm trying to insert is compatible with the schema and data types in the tables in the SQL Server Express database backing the table service, and still I don't know what the issue is. The TableDataService just won't accept the object I'm inserting. See the MSDN thread for more details. I've also opened a bug on connect.

+1  A: 

I was trying to do an extremely simple demo and I had the same problem but I was finally able to figure it out. By running against the development storage with logging turned on: See: http://blogs.msdn.com/b/partlycloudy/archive/2009/12/16/development-storage-logging.aspx

After starting the DevelopmentStorage, running my app, and then stopping the development storage and looking in the log folder I see:

9/17/2010 1:30:47 PM [Error] Caught exception during performing table operation and rethrow: System.Exception: c:\Users\Scott\AppData\Local\Temp\jvcl5gjz.0.cs(14,23) : error CS0542: 'Number': member names cannot be the same as their enclosing type

at Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableManager.EndPerformOperation(IAsyncResult ar) in x:\rd\rd_store_stable\services\xstore\XFE\table\service\Protocols\REST\src\TableManager.cs:line 184 at Microsoft.Cis.Services.Nephos.Table.Service.Protocols.Rest.TableProtocolHead.d__3e.MoveNext() in x:\rd\rd_store_stable\services\xstore\XFE\table\service\Protocols\REST\src\TableProtocolHead.cs:line 732

It turns out that my demo was too simple, because I had created a table called Number with a single column called Number...

ScottR

related questions