1

Closed

Target App Gets Exception when Launched via AutomationHelpers.StartProcess

description

I was able to recreate a similar sample project based upon your sample project from scratch and run it successfully.
However, when I tried to do this again for a larger project, it is not able to launch the target application due to the following error:
 
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Symbols loaded.
'InstInfo.exe' (Managed): Loaded 'C:\NextGen\Inc1\Week3-TestingWpfApps\InstrumentInformatics\TestResults\pfeffjd_ADDEMAL030907 2009-02-27 14_44_22\Out\InstInfo.exe', Symbols loaded.
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\PresentationFramework\3.0.0.0__31bf3856ad364e35\PresentationFramework.dll', Symbols loaded.
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\WindowsBase\3.0.0.0__31bf3856ad364e35\WindowsBase.dll', Symbols loaded.
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Symbols loaded.
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_32\PresentationCore\3.0.0.0__31bf3856ad364e35\PresentationCore.dll', Symbols loaded.
An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll
 
Additional information: Cannot find type 'InstInfo.Shell'. The assembly used when compiling might be different than that used when loading and the type is missing. Error in markup file 'InstInfo;component/Shell.xaml' Line 1 Position 17.
 
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Symbols loaded.
'InstInfo.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Symbols loaded.
 
Can you provide advice on how to debug this? It cannot launch the test project "instInfo" from this line:
 
        Process appProcess = AutomationHelpers.StartProcess(new ProcessStartInfo("InstInfo.exe"), out rootElement); 
 
Note that InstInfo.Shell is the main StartupUri WPF window of the target application:
 
<Application x:Class="InstInfo.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:Presenters="clr-namespace:InstInfo.Presenters"
xmlns:Model="clr-namespace:InstInfo.Model"
StartupUri="Shell.xaml">
 
Also, I'm not sure if any of this is important, but it is a RibbonWinow:
 
<r:RibbonWindow x:Class="InstInfo.Shell"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:r="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary"
xmlns:me="clr-namespace:InstInfo"
xmlns:uc="clr-namespace:InstInfo.UserControls"
Title="Target Test App"
WindowStartupLocation="CenterScreen"
Background="{DynamicResource WindowBackground}"
AutomationProperties.AutomationId="autoShellWindow" >
 
Note this same target process can be successfully launched through the VS2008 IDE or be double clicking on the InstInfo.exe located
either in the test project or original target project bin/Debug directory:
 
Here is the call stack when attaching to the failed target app process.
 
PresentationFramework.dll!System.Windows.Markup.XamlParseException.ThrowException(string message, System.Exception innerException, int lineNumber, int linePosition, System.Uri baseUri, System.Windows.Markup.XamlObjectIds currentXamlObjectIds, System.Windows.Markup.XamlObjectIds contextXamlObjectIds, System.Type objectType) + 0x1bf bytes
PresentationFramework.dll!System.Windows.Markup.XamlParseException.ThrowException(System.Windows.Markup.ParserContext parserContext, int lineNumber, int linePosition, string message, System.Exception innerException) + 0x58 bytes    
PresentationFramework.dll!System.Windows.Markup.BamlRecordReader.ReadRecord(System.Windows.Markup.BamlRecord bamlRecord) + 0x75f bytes  
PresentationFramework.dll!System.Windows.Markup.BamlRecordReader.Read(bool singleRecord = false) + 0x1c bytes   
PresentationFramework.dll!System.Windows.Markup.TreeBuilderBamlTranslator.ParseFragment() + 0xc9 bytes  
PresentationFramework.dll!System.Windows.Markup.TreeBuilder.Parse() + 0xf bytes 
PresentationFramework.dll!System.Windows.Markup.XamlReader.LoadBaml(System.IO.Stream stream, System.Windows.Markup.ParserContext parserContext, object parent, bool closeStream) + 0xc7 bytes   
PresentationFramework.dll!System.Windows.Application.LoadBamlStreamWithSyncInfo(System.IO.Stream stream, System.Windows.Markup.ParserContext pc) + 0xb6 bytes   
PresentationFramework.dll!System.Windows.Application.LoadComponent(System.Uri resourceLocator, bool bSkipJournaledProperties) + 0xcf bytes  
PresentationFramework.dll!System.Windows.Application.DoStartup() + 0xe4 bytes   
PresentationFramework.dll!System.Windows.Application..ctor.AnonymousMethod(object unused) + 0x36 bytes  
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = {System.Object <.ctor>b__0(System.Object)}}, object args = null, bool isSingleParameter = true) + 0x8a bytes    
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x4a bytes  
WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x44 bytes 
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeImpl() + 0x5d bytes  
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(object state) + 0x38 bytes 
mscorlib.dll!System.Threading.ExecutionContext.runTryCode(object userData) + 0x51 bytes 
[Native to Managed Transition]  
[Managed to Native Transition]  
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x67 bytes    
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state) + 0x45 bytes    
WindowsBase.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0x63 bytes  
WindowsBase.dll!System.Windows.Threading.Dispatcher.ProcessQueue() + 0x127 bytes    
WindowsBase.dll!System.Windows.Threading.Dispatcher.WndProcHook(System.IntPtr hwnd, int msg, System.IntPtr wParam, System.IntPtr lParam, ref bool handled) + 0x63 bytes 
WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd = 529260, int msg = 49785, System.IntPtr wParam = 0, System.IntPtr lParam = 0, ref bool handled = false) + 0xbe bytes   
WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(object o) + 0x7a bytes    
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate callback = {Method = {System.Object DispatcherCallbackOperation(System.Object)}}, object args = {MS.Win32.HwndSubclass.DispatcherOperationCallbackParameter}, bool isSingleParameter = true) + 0x8a bytes    
WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.TryCatchWhen(object source = {System.Windows.Threading.Dispatcher}, System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler = null) + 0x4a bytes  
WindowsBase.dll!System.Windows.Threading.Dispatcher.WrappedInvoke(System.Delegate callback, object args, bool isSingleParameter, System.Delegate catchHandler) + 0x44 bytes 
WindowsBase.dll!System.Windows.Threading.Dispatcher.InvokeImpl(System.Windows.Threading.DispatcherPriority priority, System.TimeSpan timeout, System.Delegate method, object args, bool isSingleParameter) + 0x91 bytes 
WindowsBase.dll!System.Windows.Threading.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority priority, System.Delegate method, object arg) + 0x40 bytes   
WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd = 529260, int msg = 49785, System.IntPtr wParam = 0, System.IntPtr lParam = 0) + 0xdc bytes    
[Native to Managed Transition]  
[Managed to Native Transition]  
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame frame = {System.Windows.Threading.DispatcherFrame}) + 0xc7 bytes 
WindowsBase.dll!System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame frame) + 0x49 bytes  
WindowsBase.dll!System.Windows.Threading.Dispatcher.Run() + 0x4c bytes  
PresentationFramework.dll!System.Windows.Application.RunDispatcher(object ignore) + 0x1e bytes  
PresentationFramework.dll!System.Windows.Application.RunInternal(System.Windows.Window window) + 0x6f bytes 
PresentationFramework.dll!System.Windows.Application.Run(System.Windows.Window window) + 0x26 bytes 
PresentationFramework.dll!System.Windows.Application.Run() + 0x19 bytes 
InstInfo.exe!InstInfo.App.Main() + 0x4c bytes   C#
Closed Feb 10, 2011 at 9:49 PM by ivom
Jon,I am closing this issue.Please, reactivate if you have a reliable repro and we will investigate.Thanks!Ivo

comments

ivom wrote Feb 27, 2009 at 9:37 PM

Hello,
We are looking into this issue and will get back to you.
Thanks:
Ivo Manolov

ivom wrote Mar 27, 2009 at 11:18 PM

Jon,
We will be soon releasing a new version of TestApi with better support for running tests in-proc and out-of-proc. Can you still repro the problem above? If so, could you attach a memory dump so that we can debug the issue locally?
Thanks,
Ivo

wrote Feb 10, 2011 at 9:49 PM

wrote Feb 14, 2013 at 8:08 PM

wrote May 16, 2013 at 10:02 AM