title: facing "Microsoft .NET framework unhandled exception has occurred in your application" error when trying to open an application using pywinauto
body: <p>I am trying to automate an application using python &quot;pywinauto&quot; library, but when I run the code I face the &quot;Microsoft .NET framework unhandled exception has occurred in your application&quot; error. however, when I open the application without code, it opens with no error!</p>
  <p>here are the details of error:</p>
  <p><a href="https://i.stack.imgur.com/UYKqK.png" rel="nofollow noreferrer">the error</a></p>
  <p>See the end of this message for details on invoking
  just-in-time (JIT) debugging instead of this dialog box.</p>
  <p>************** Exception Text **************</p>
  <pre><code>System.ApplicationException: Usage: mstop &lt;instrument-number&gt;, &lt;macro&gt;, &lt;start-macro-file&gt;
     at MSTop.FormMSTop.InitializeCommandProcessor() in E:\ccviews\Mustang\Mustang\parts\mstop.net\FormMSTop.cs:line 44
     at System.Windows.Forms.Form.OnLoad(EventArgs e)
     at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
     at System.Windows.Forms.Control.CreateControl()
     at System.Windows.Forms.Control.WmShowWindow(Message&amp; m)
     at System.Windows.Forms.Control.WndProc(Message&amp; m)
     at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
     at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  </code></pre>
  <p>************** Loaded Assemblies **************</p>
  <pre><code>mscorlib
      Assembly Version: 2.0.0.0
      Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
      CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v2.0.50727/mscorlib.dll
  ----------------------------------------
  MSTop
      Assembly Version: 1.0.0.0
      Win32 Version: 1.0.0.0
      CodeBase: file:///C:/msdchem/MSexe/mstop.exe
  ----------------------------------------
  System.Windows.Forms
      Assembly Version: 2.0.0.0
      Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
      CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
  ----------------------------------------
  System
      Assembly Version: 2.0.0.0
      Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
      CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
  ----------------------------------------
  System.Drawing
      Assembly Version: 2.0.0.0
      Win32 Version: 2.0.50727.8745 (WinRel.050727-8700)
      CodeBase: file:///C:/Windows/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
  ----------------------------------------
  HIACPNet
      Assembly Version: 1.0.0.0
      Win32 Version: 1.0.0.0
      CodeBase: file:///C:/msdchem/MSexe/HIACPNet.DLL
  ----------------------------------------
  MSDChemCPUtil
      Assembly Version: 1.0.0.0
      Win32 Version: 1.0.0.0
      CodeBase: file:///C:/msdchem/MSexe/MSDChemCPUtil.DLL
  </code></pre>
  <hr />
  <p>************** JIT Debugging **************
  To enable just-in-time (JIT) debugging, the .config file for this
  application or computer (machine.config) must have the
  jitDebugging value set in the system.windows.forms section.
  The application must also be compiled with debugging
  enabled.</p>
  <p>For example:</p>
  <pre><code>&lt;configuration&gt;
      &lt;system.windows.forms jitDebugging=&quot;true&quot; /&gt;
  &lt;/configuration&gt;
  </code></pre>
  <p>When JIT debugging is enabled, any unhandled exception
  will be sent to the JIT debugger registered on the computer
  rather than be handled by this dialog box.</p>