Strange resource dictionary warnings appear in output window even when the WPF trace settings are turned off

依然范特西╮ 提交于 2019-12-18 03:55:21

问题


I am using Visual studio 2011 beta with the april 2012 update installed .I have my Debugging options -> Output window > WPF trace settings all the values including Resource Dictionaries turned off.But I still continue to see warning messages like

System.Windows.ResourceDictionary Warning: 9 : Resource not found; 
     ResourceKey='CheckBoxCooperStyle1'

How to debug this type of warnings provided they are not false positives ?


回答1:


Reply from Microsoft support team "Thanks for the update. I was afraid of that, since my testing found similar results. It seems there is some internal WPF tracing code which does not adhere to the specified settings. In the meantime, We don’t have any suggestions other than finding the Resource Dictionary (or the relevant type) and correcting the issues that the trace output is warning about.

if a debugger was attached, there will always be some WPF tracing emitted regardless of the settings specified in the IDE (or in the app.config). Unfortunately, the output you are receiving appears to fall into this category. Regrettably, there is no way to turn off all the WPF trace output from being emitted

We could certainly file a feature request for the product for this to be considered in a future release, but otherwise I don’t see a way for you to avoid the issue in the current release.




回答2:


I got these Messages when mixing static resources and dynamic resources. Setting all the Problematic Resource settings to StaticResource solved the problem. Instead of:

Style="{DynamicResource CheckBoxCooperStyle1}"

Use:

Style="{StaticResource CheckBoxCooperStyle1}"


来源:https://stackoverflow.com/questions/10822003/strange-resource-dictionary-warnings-appear-in-output-window-even-when-the-wpf-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!