I see the following error quite a lot in our error logs (probably 10 times a day out of 600 daily users):
Exception: OpenRiaServices.DomainServices.Client.SubmitOperationException: Submit operation failed. Object reference not set to an instance of an object.
at OpenRiaServices.DomainServices.Hosting.ChangeSetProcessor.CreateChangeSet(IEnumerable`1 changeSetEntries)
at OpenRiaServices.DomainServices.Hosting.ChangeSetProcessor.Process(DomainService domainService, IEnumerable`1 changeSetEntries)
at OpenRiaServices.DomainServices.Hosting.SubmitOperationBehavior.SubmitOperationInvoker.InvokeCore(Object instance, Object inputs, Object& outputs)
Any ideas on what might be causing this? I've never been able to repeat the bug unfortunately, but one common theme is that it only occurs after the application is left idle for an hour or more. I thought it was a timeout issue but my aspx session timeouts are set to 3 days!
Looking at the code, the only way I could see that error happening is if a Submit request hit the server with a null set of changes. That isn't anything I have seen happen before, but your thought of something timing out after being idle sounds likely. It would probably be the application pool, not your aspx session, that timed out. Are these WCF logs that you are seeing the error in? If you have the message itself logged it would be interesting to see if the submit message looks correct.
Thanks for looking into this. I've tried to reproduce the error on my dev box by doing both a recycle and an iisreset but to no avail. I've added the following checks before SubmitChanges to try and catch an empty changeset over the next few days:
EntityChangeSet changeSet = chroniclesDomainContext.EntityContainer.GetChanges();
throw new InvalidOperationException("ChangeSet is Empty!");
else if (!changeSet.GetChangeSetEntries().Any())
throw new InvalidOperationException("There are no ChangeSet entries!");
They are not in the WCF trace logs - there are no errors relating to this that I can see, but as far as I can tell this error occurs before any service call is made (?). The errors come from the App.Application_UnhandledException event where I email the call stack to myself.
The stack trace is showing server side code, not client side code. ChangeSetProcessor only exists in the server, it isn't one of the classes that exists on both sides, so you must be hitting the service.
Well the extra code I put in to catch any funnies didn't trigger and I'm still getting a few errors. I did re-examine the svc trace logs and eventually tracked down the error in the logs but it didn't tell me anything new.