我的应用程序是多窗口.如果发生XamlParseException,则关闭整个应用程序.
我最想做的是关闭这个错误的"负责"窗口.
你知道实现这个目标的方法吗?
一个例外情况:
System.Windows.Markup.XamlParseException: Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception. ---> System.Exception: Cannot find resource named 'PasteCommandRef'. Resource names are case sensitive. at System.Windows.StaticResourceExtension.ProvideValueInternal(IServiceProvider serviceProvider, Boolean allowDeferredReference) at System.Windows.StaticResourceExtension.ProvideValue(IServiceProvider serviceProvider) at MS.Internal.Xaml.Runtime.ClrObjectRuntime.CallProvideValue(MarkupExtension me, IServiceProvider serviceProvider) --- End of inner exception stack trace --- at System.Windows.Markup.XamlReader.RewrapException(Exception e, Uri baseUri) at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlReader templateReader, XamlObjectWriter currentWriter) at System.Windows.FrameworkTemplate.LoadTemplateXaml(XamlObjectWriter objectWriter) at System.Windows.FrameworkTemplate.LoadOptimizedTemplateContent(DependencyObject container, IComponentConnector componentConnector, IStyleConnector styleConnector, List`1 affectedChildren, UncommonField`1 templatedNonFeChildrenField) at System.Windows.FrameworkTemplate.LoadContent(DependencyObject container, List`1 affectedChildren) at System.Windows.StyleHelper.ApplyTemplateContent(UncommonField`1 dataField, DependencyObject container, FrameworkElementFactory …
我注意到string.Join(" ", new object[] { null, "a", null, "b"})退货string.Empty
注意string.Join(" ", new string[] { null, "a", null, "b"})返回a b(正如我期望的那样)
连接字符时,事情变得恶毒:
string.Join(" ", new object[] { null, 'a', null, 'b'})它还会返回string.Empty
编辑:即使文档说了这件事(感谢@elgonzo),是否有合理的理由在框架中实现了这种例外?