Win32Exception - while running the tests

Ranorex Spy, Recorder, and Studio.
User avatar
Posts: 15
Joined: Tue Mar 10, 2015 7:41 am

Win32Exception - while running the tests

Post by Ceaser » Wed Oct 12, 2016 6:45 am

We are getting a strange exception from the SUT while running automation tests!
I am pasting the exception text, please see the text below.

This exception can even be reproduced with spy tool (spy an element in the SUT and add to repository, then try to highlight the element next relaunch of SUT)



An exception of type 'System.ComponentModel.Win32Exception' occurred and was caught.
Exception Messages:
Win32Exception : The parameter is incorrect

Type : System.ComponentModel.Win32Exception, System, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089
Message : The parameter is incorrect
Context Messages:
Unhandled exception caught in process WPF.
Data: :
Source : WindowsBase
NativeErrorCode: 87
ErrorCode : -2147467259
TargetSite : Int32 GetWindowText(System.Runtime.InteropServices.HandleRef, System.Text.StringBuilder, Int32)
Stack Trace : at MS.Win32.UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)
at System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()
at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()
at System.Windows.ContextLayoutManager.fireAutomationEvents()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.ContextLayoutManager.UpdateLayoutCallback(Object arg)
at System.Windows.Media.MediaContext.FireInvokeOnRenderCallbacks()
at System.Windows.Media.MediaContext.RenderMessageHandlerCore(Object resizedCompositionTarget)
at System.Windows.Media.MediaContext.AnimatedRenderMessageHandler(Object resizedCompositionTarget)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
Additional Info:
MachineName : TestMachine
TimeStamp : 2016-09-14T15:59:56.663+01:00
AppDomainName: WPF.exe
WindowsIdentity: TestMachine\user1

User avatar
Support Team
Site Admin
Site Admin
Posts: 12169
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA

Re: Win32Exception - while running the tests

Post by Support Team » Thu Oct 13, 2016 1:37 pm

Hello Ceaser,

First, may I ask which version of Ranorex you currently use?

Could you please upload a Ranorex Snapshot of the SUT? This gives me more information about the used technology and about which Ranorex plugin is used to access the SUT.

Thank you in advance.


User avatar
Posts: 15
Joined: Tue Mar 10, 2015 7:41 am

Re: Win32Exception - while running the tests

Post by Ceaser » Thu Oct 13, 2016 4:22 pm

Hello Johannes,
Thanks for the reply.

I am using Ranorex version

SUT is a WPF Application.
In this WPF application some Windows Forms Control are also hosted.

This exception occurs unpredictable.


User avatar
Ranorex Guru
Ranorex Guru
Posts: 6548
Joined: Mon Aug 13, 2012 9:54 am
Location: Zilina, Slovakia

Re: Win32Exception - while running the tests

Post by odklizec » Fri Oct 14, 2016 7:17 am


Ranorex 5.4.4 is no longer supported. Please try to reproduce the problem with latest Ranorex 6.1 (even in trial mode). If the problem still occurs, please post a Ranorex snapshot of the problematic element. But I guess Ranorex folks would need also a sample application so they can debug the problem to see if it's a problem in Ranorex or your app. BTW, what OS you are using?
Pavel Kudrys
Ranorex explorer at Descartes Systems

Please add these details to your questions:
  • Ranorex Snapshot. Learn how to create one >here<
  • Ranorex xPath of problematic element(s)
  • Ranorex version
  • OS version
  • HW configuration

User avatar
Posts: 15
Joined: Tue Mar 10, 2015 7:41 am

Re: Win32Exception - while running the tests

Post by Ceaser » Tue Oct 18, 2016 10:33 am


I wlll try in Ranorex 6.1
we are using windows 7