从 RIA 服务加载数据时 Silverlight 中出现偶发 Arg_COMException

发布于 2024-10-19 18:06:10 字数 1749 浏览 1 评论 0原文

用户在使用应用程序时有时会遇到奇怪的异常。我无法重现它。当执行一个特定的域服务查询时会发生这种情况。此查询经常执行(每次用户保存更改时)。

查询没有参数。有简单的过滤: Context.GetEventsQuery().Where(lce => lce.Id > maxId)

域服务方法很简单: 公共 IQueryable GetEvents() { 返回 ObjectContext.Events; 第一次发生后

,每次都会发生(直到用户刷新网页)。

以下是日志中的异常文本: 查询“GetEvents”的加载操作失败。 System.ServiceModel.DomainServices.Client.DomainOperationException:查询“GetEvents”的加载操作失败。 ---> System.Exception --->系统异常:[Arg_COMException] 论据: 调试资源字符串不可用。通常,键和参数提供了足够的信息来诊断问题。请参阅 http:// go.microsoft.com/fwlink/?linkid=106663&Version=4.0.50917.0&File=mscorlib.dll&Key=Arg_COMException 在 System.Net.Browser.BrowserHttpWebRequest.InternalEndGetResponse(IAsyncResult asyncResult) 在 System.Net.Browser.BrowserHttpWebRequest.<>c__DisplayClass5.b__4(Object sendState) 在 System.Net.Browser.AsyncHelper.<>c__DisplayClass2.b__0(Object sendState) --- 内部异常堆栈跟踪结束 --- 在 System.ServiceModel.DomainServices.Client.WebDomainClient`1.EndQueryCore(IAsyncResult asyncResult) 在 System.ServiceModel.DomainServices.Client.DomainClient.EndQuery(IAsyncResult asyncResult) 在 System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) --- 内部异常堆栈跟踪结束 --- 在System.ServiceModel.DomainServices.Client.OperationBase.Complete(异常错误) 在System.ServiceModel.DomainServices.Client.LoadOperation.Complete(异常错误) 在 System.ServiceModel.DomainServices.Client.DomainContext.CompleteLoad(IAsyncResult asyncResult) 在 System.ServiceModel.DomainServices.Client.DomainContext.<>c__DisplayClass1b.b__17(Object )

原因可能是什么?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

-黛色若梦 2024-10-26 18:06:10

我们遇到了同样的零星问题。追踪到竞争条件,我们在域数据源上同时多次调用“加载”。

在我们的例子中,我们为域数据源编写了一个名为“DurableDomainDataSourceBehavior”的附加行为。它的工作是捕获失败的加载,检查是否存在通信异常,如果存在,则等待几秒钟,然后再次尝试加载。我们发现我们有一些有缺陷的逻辑,将多个行为实例附加到同一个域数据源实例。当最终用户在加载 DurableDomainDataSourceBehavior 的每个实例时遇到网络相关问题时,将调用 load,从而导致 arg_ComException。解决方法是确保我们没有将行为的多个实例附加到同一个域数据源实例,并查找代码中可能同时多次调用 DomainDataSource.Load 的其他位置。

我不确定这是否特定于 DomainDataSource 或者是否可以使用 DomainContext 自己复制。我无法在本地重现该问题,但我可以确认,自从我们修复后,它不再出现在日志中。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文