Silverlight 4 应用程序冻结而不抛出任何异常

发布于 2024-12-20 05:32:22 字数 881 浏览 4 评论 0原文

我正在开发 Silverlight 4 RIA 应用程序。有一个DataGrid 存储数据和两个按钮:添加新项目和删除项目。在第二次创建新项目后,应用程序冻结,如 this - 我将解释下面的奇怪行为。

创建新项目的场景如下所示:

  1. 单击后,出现子窗口。对父页面上使用的域数据源的引用正在 传递给构造函数中的子窗口。
  2. 用户选择一个文件。
  3. 该文件被发送到 Web 服务。作为响应,Web 服务返回该文件中的一些数据。
  4. 正在创建新的数据对象并将其插入到域数据源。

子窗口仅在调用两次时才会导致整个应用程序冻结,但第一次调用需要创建对象。我可以重复打开和关闭子窗口,一切都会正常工作,直到出现以下序列: open.create -> open.close / open.create 发生。我尝试使用 VS 工具(alt ctrl e)跟踪所有异常,但没有。

断点

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)

也不会显示任何内容。有什么想法吗?

页面代码。 子窗口代码

I'm developing a Silverlight 4 RIA application. There is a DataGrid storing data and two buttons: add a new item and remove an item. After creating a new item for the second time the application freezes like this - I'll explain the strange behaviour below.

The scenario of creating a new item looks like this:

  1. After clicking, the child window appears. The reference to the domain data source used on the parrent page is being
    passed to the child window in the constructor.
  2. The user chooses a file.
  3. The file is send to a web service. In response the web service returns some data from that file.
  4. A new data object is being created and inserted to domain data source.

The child window causes the entire application to freeze only when it's called twice, but the first call requires object creation. I can open and close the child window repeatedly and everything will work fine until a sequence of: open.create -> open.close / open.create occurs. I tried to trace all exceptions with VS tool (alt ctrl e) but there are none.

A breakpoint on

private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e)

does not show anything either. Any ideas?

Page code.
Child window code

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

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

发布评论

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

评论(2

水波映月 2024-12-27 05:32:22

删除以下内容,一切都会好起来的。

    private void ChildWindow_Closed(object sender, EventArgs e)
    {
        this.DialogResult = false;
    }

进一步评估一下,ChildWindow_Closed 是首先设置 DialogResult 的结果。
通过重新设置它会发生意想不到的事情。

Remove the following and everything will be fine.

    private void ChildWindow_Closed(object sender, EventArgs e)
    {
        this.DialogResult = false;
    }

And to evaluate a bit more, ChildWindow_Closed is the outcome of setting the DialogResult at the first place.
By re setting it unexpected things happen.

Saygoodbye 2024-12-27 05:32:22

在你帮助我解决这个问题后,我做了更多的研究。看来是 SL4 的 bug。
这也应该有帮助。 SL 论坛上有关此内容的主题。

protected override void OnClosed(EventArgs e)
    {
        base.OnClosed(e);
        Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true);
    }

I did a bit more research after you helped me with this issue. Seems its a SL4 bug.
This should also help. Topic about this on SL forums.

protected override void OnClosed(EventArgs e)
    {
        base.OnClosed(e);
        Application.Current.RootVisual.SetValue(Control.IsEnabledProperty, true);
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文