I am using a WPF library which work asynchronously.
This code is called in plugins, both in Administration (in a tab) and Smart Client (a plugin).
However, sometimes the library throws exceptions. As it isn’t called from my code (overrides of ViewItemWpfUserControl for instance), I can’t catch the exception. Thus the exception force the app to close :
Here are 2 examples:
1- In Management Client
************** Exception Text **************
************** Inner Exception **************
Exception source: ThinkGeo.UI.Wpf
Type d'exception : System.Xml.XPath.XPathException
Message d'exception : Le préfixe de l'espace de noms 'sm' n'est pas défini.
Exception target site: MoveNext
à ThinkGeo.Core.TileOverlay.<DrawMultipleTilesInWorkerThreadAsync2>d__93.MoveNext()
--- Fin de la trace de la pile à partir de l'emplacement précédent au niveau duquel l'exception a été levée ---
à System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
à System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
à ThinkGeo.Core.TileOverlay.<<drawingTimer_Tick>b__145_0>d.MoveNext()
************** Outer Exception **************
Exception source: Aucune exception de tâche n'a été observée en attendant la tâche ou en accédant à sa propriété Exception. Par conséquent, l'exception non prise en charge a été à nouveau levée par le thread finaliseur.
Type d'exception : System.AggregateException
Message d'exception : Aucune exception de tâche n'a été observée en attendant la tâche ou en accédant à sa propriété Exception. Par conséquent, l'exception non prise en charge a été à nouveau levée par le thread finaliseur.
Exception target site: Aucune exception de tâche n'a été observée en attendant la tâche ou en accédant à sa propriété Exception. Par conséquent, l'exception non prise en charge a été à nouveau levée par le thread finaliseur.
2- In XProtect Smart Client
************** Outer Exception **************
Type d'exception :System.NullReferenceException
Message d'exception :La référence d'objet n'est pas définie à une instance d'un objet.
Source d'exception :ThinkGeo.UI.Wpf
Site de la cible d'exception : 8Eo=
à ThinkGeo.Core.MapViewBase.8Eo=(Object sender, SizeChangedEventArgs e)
à System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
à System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
à System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
à System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
à System.Windows.FrameworkElement.OnRenderSizeChanged(SizeChangedInfo sizeInfo)
à System.Windows.ContextLayoutManager.fireSizeChangedEvents()
à System.Windows.ContextLayoutManager.UpdateLayout()
à System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
à System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
à System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
à System.Windows.Media.MediaContext.RenderMessageHandler(Object resizedCompositionTarget)
à System.Windows.Interop.HwndTarget.OnResize()
à System.Windows.Interop.HwndTarget.HandleMessage(WindowMessage msg, IntPtr wparam, IntPtr lparam)
à System.Windows.Interop.HwndSource.HwndTargetFilterMessage(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
à MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
à MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
à System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
à System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Is there a way to ignore and just log any exceptions coming from a specific DLL ? Or to catch those exceptions ?
