Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sporadic Arg_COMException in Silverlight when loading data from RIA service

Users sometimes get strange exception while working with application. I could not ever reproduce it. It happens when executing one particular domain service query. This query gets executed quite often (each time user saves changes).

Query does not have parameters. There is simple filtering: Context.GetEventsQuery().Where(lce => lce.Id > maxId)

Domain service method is simple: public IQueryable GetEvents() { return ObjectContext.Events; }

After it happens first time, it keeps happening every time (until user refreshes the webpage).

Here is exception text from logs: Load operation failed for query 'GetEvents'. System.ServiceModel.DomainServices.Client.DomainOperationException: Load operation failed for query 'GetEvents'. ---> System.Exception ---> System.Exception: [Arg_COMException] Arguments: Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=mscorlib.dll&Key=Arg_COMException at System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) at System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState) at System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState) --- End of inner exception stack trace --- at System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) --- End of inner exception stack trace --- at System.ServiceModel.DomainServices.Client.OperationBase.Complete(Exception error) at System.ServiceModel.DomainServices.Client.LoadOperation.Complete(Exception error) at System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) at System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.b__17(Object )

What can be the reason?

like image 459
Pavel Tupitsyn Avatar asked Mar 01 '11 13:03

Pavel Tupitsyn


1 Answers

We had the same sporadic issue. Tracked it down to race condition where we were calling "load" on a domain data source more than once at the same time.

In our case we had written an attached behavior for the domaindatasource called "DurableDomainDataSourceBehavior". It's job was to catch failed loads, check if there was a communicationexception and if there was, wait a few seconds before attempting to load again. We found we had some flawed logic that was attaching multiple instances of the behavior to the same domaindatasource instance. When an end user hit a network related issue while loading each instance of the DurableDomainDataSourceBehavior would call load which resulted in the arg_ComException. The fix was to make sure we didn't attach multiple instances of the behavior to the same domaindatasource instance and to look for other spots in the code where we might be calling DomainDataSource.Load more than once at the same time.

I'm not sure if this is specific to the DomainDataSource or if it can be reproduced with a DomainContext on it's own. I was never able to reproduce the issue locally but I can confirm that since our fix it's no longer appearing in the logs.

like image 68
Jeremy Danyow Avatar answered Sep 30 '22 14:09

Jeremy Danyow