Silverlight DataForm 内存泄漏

发布于 2024-09-03 08:35:31 字数 1094 浏览 2 评论 0 原文

一些背景

我注意到设置 DataForm 的 EditTemplate(来自 Silverlight Toolkit)可能会导致 DataForm 不被垃圾收集。因此,DataForm 的父控件也无法进行垃圾收集,从而导致非常严重的内存泄漏。

下面是一些演示这种情况的 XAML。

    <toolkit:DataForm HorizontalAlignment="Stretch" Margin="10" VerticalAlignment="Stretch">
        <toolkit:DataForm.EditTemplate>
            <DataTemplate>
                <toolkit:DataField Label="Dummy Binding:">
                    <TextBox Text="{Binding DummyBinding, Mode=TwoWay}" />
                </toolkit:DataField>
            </DataTemplate>
        </toolkit:DataForm.EditTemplate>
    </toolkit:DataForm>

我已在 CodePlex 上提出问题。该问题有一个附件,其中包含 项目 演示了该案例。

所以,我的问题是

还有其他人遇到过这个问题吗?更重要的是,有人知道任何解决方法吗?我怎样才能强制这个DataForm被垃圾收集?

Some Background

I have noticed that setting the EditTemplate of a DataForm (from the Silverlight Toolkit) can cause the DataForm to not be garbage collected. Consequently, the parent control of the DataForm cannot be garbage collected either, causing a very significant memory leak.

Here's some XAML which demonstrates the case.

    <toolkit:DataForm HorizontalAlignment="Stretch" Margin="10" VerticalAlignment="Stretch">
        <toolkit:DataForm.EditTemplate>
            <DataTemplate>
                <toolkit:DataField Label="Dummy Binding:">
                    <TextBox Text="{Binding DummyBinding, Mode=TwoWay}" />
                </toolkit:DataField>
            </DataTemplate>
        </toolkit:DataForm.EditTemplate>
    </toolkit:DataForm>

I have opened an issue on CodePlex. The isssue has an attachment which has a project which desmonstrates the case.

So, My Question Is

Has anyone else encountered this issue? More importantly, does anyone know of any workarounds? How can I force this DataForm to be garbage collected?

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

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

发布评论

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

评论(2

椒妓 2024-09-10 08:35:32

仅供参考,对于任何关心这个问题的人...微软发布了一个修复程序。

Silverlight 4 服务版本

FYI, to anyone concerned about this issue... MS released a fix for this.

Silverlight 4 Service Release

他夏了夏天 2024-09-10 08:35:32

事实证明,这个问题并不是 DataForm 控件特有的,它实际上是 Silverlight 4 运行时的问题。所有使用 DataTemplate 的内置控件和用户控件都存在此问题,此线程。 Tim Heuer(Silverlight 项目经理)在该线程中做出了响应,并提出了一种可能的解决方法,结果好坏参半。他确实提到他们已经有一个修复程序进入测试,所以希望更新应该很快发布。

It turns out that this issue is not specific to the DataForm control, and that it is actually a problem with the Silverlight 4 runtime. All built-in controls and user controls that use a DataTemplate have this issue as discussed in greater detail in this thread. Tim Heuer (the Silverlight Program Manager) is responsive on the thread and proposes a possible workaround with mixed results. He does mention that they already have a fix entered into testing, so hopefully an update should be released relatively soon.

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