Windows 7 次更新,在 WPF 应用程序中产生 "Item has already been added. Key in dictionary: controlbrush"

Windows 7 update, results in "Item has already been added. Key in dictionary: controlbrush" in WPF application

我在这里遇到了一点麻烦,我有一个 WPF 应用程序 运行 几年来没有任何问题。现在 Microsoft 推出了 windows 7 的更新,导致应用程序出现以下错误。

System.Windows.Markup.XamlParseException: Set property 'System.Windows.ResourceDictionary.DeferrableContent' threw an exception. ---> System.ArgumentException: Item has already been added. Key in dictionary: 'ControlBrush'  Key being added: 'ControlBrush'

这好像是突然被下面的代码触发的

<TreeView.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.ControlBrushKey}" Color="Transparent" />
</TreeView.Resources>

用于覆盖多个 windows 中的默认样式。 我想我无法让 Microsoft 更改他们的更新,所以我必须更新我的代码以某种方式处理这个问题。 有没有人对可以解决此问题的解决方法、代码更改提出建议?

澄清一下,代码在上个月没有更改并且 运行 很好,在更新了两个 windows 7 台电脑后,它们都开始显示此行为。

更新

好像是针对treeview组件,问题存在。

更新 2

导致该问题的更新是 kb4520406,这是一个 .Net 更新(预览版)

kb4520406 更新包含导致此问题的包 ndp48-kb4519568-x86_57739704597ae82f771152c084d756d2f187b13f.exe,删除它并安装 ndp48-kb4515847-x86_3a86918366a8073eb9484c8c6f17a2b20b0088f6.exe 而不是预览解决了问题。

所以我还没有尝试解决购买代码更改问题。

我们在安装 KB4519568 后在我们的应用程序中遇到了同样的问题(添加了 ControlBrush,即使它已经存在)。有趣的是,我们的应用程序受 Wibu 保护(加密狗),如果我删除 Wibu 保护,问题就消失了。你也用维布保护吗?