My application is multi-windowed. If an XamlParseException occurs, the entire application is closed.
What I would like to do as much as possible closes the window "responsible" for this error.
Do you know a way to achieve this?
Exception example:
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 templateRoot, Int32 lastChildIndex, HybridDictionary childIndexFromChildID, FrameworkTemplate frameworkTemplate)
at System.Windows.FrameworkTemplate.ApplyTemplateContent (UncommonField`1 templateDataField, FrameworkElement container)
at System.Windows.FrameworkElement.ApplyTemplate ()
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at System.Windows.Controls.Primitives.UniformGrid.MeasureOverride (Size constraint)
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at MS.Internal.Helper.MeasureElementWithSingleChild (UIElement element, Size constraint)
at System.Windows.Controls.ItemsPresenter.MeasureOverride (Size constraint)
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at System.Windows.Controls.Border.MeasureOverride (Size constraint)
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at System.Windows.Controls.Control.MeasureOverride (Size constraint)
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at System.Windows.Controls.Grid.MeasureCell (Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup (Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureOverride (Size constraint)
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at System.Windows.Controls.Grid.MeasureCell (Int32 cell, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureCellsGroup (Int32 cellsHead, Size referenceSize, Boolean ignoreDesiredSizeU, Boolean forceInfinityV)
at System.Windows.Controls.Grid.MeasureOverride (Size constraint)
at System.Windows.FrameworkElement.MeasureCore (Size availableSize)
at System.Windows.UIElement.Measure (Size availableSize)
at System.Windows.ContextLayoutManager.UpdateLayout ()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback (Object arg)
at System.Windows.Media.MediaContext.InvokeOnRenderCallback.DoWork ()
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks ()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore (Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.RenderMessageHandler (Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall (Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen (Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
source
share