Cannot resolve TargetName x


After open a floating dialog window and the trying to open a Built-In ChildWindow you get the following error: InvalidOperationException was unhandled by user code : Cannot resolve TargetName x


lsmventure wrote Nov 17, 2011 at 9:46 AM

This is an intermittent problem we have experienced too. The 'X' relates to the name of the path object responsible for creating the close button. The State Manager is firing a state which in turn is trying to manipulate the path only to find it does not exist. Looking at the template for a child window, the object, 'X', clearly does exist in the logical tree so this must be a visual tree issue where the object is referenced before it has been rendered.
However we have been unsuccessful in our attempts to fix this issue by removing all visual states that relate to 'X' - the error still occurs.
Our only resolution is to catch the unhandled exception in the app code behind and handle it:

if (!System.Diagnostics.Debugger.IsAttached)
            e.Handled = true;
            if (!e.ExceptionObject.Message.Contains("TargetName X"))
                Deployment.Current.Dispatcher.BeginInvoke(delegate { ReportErrorToDOM(e); });

wrote Feb 14, 2013 at 7:13 PM