.NET application (AUT) blacks out when recording is run

Ranorex Spy, Recorder, and Studio.
anupama.sasi
Posts: 1
Joined: Tue Sep 30, 2014 5:56 am

.NET application (AUT) blacks out when recording is run

Post by anupama.sasi » Tue Sep 30, 2014 10:00 am

When a recording is run, half of the application GUI turns black and the object which is still visible is not identified by Ranorex.

Please see the attachments (.rxsnp for AUT snapshot and .jpg for error snapshot).

System description:
- Windows 7
- 32 bit OS
- Ranorex version 4.1.5.17134

Such a behaviour is not seen otherwise (without Ranorex).
Please suggest a solution to avoid this situation.


Last successful step was executed in this function:
//

private Ranorex.Text FindLabelForParameter(string paramName, bool throwOnMissing = true)
        {
        	var candidates = repo.FormMAP120.MDI_Form.FeatureScrollViewer.Find<Ranorex.Text>(".//text").ToList();
        	var orderedCandidates = candidates.OrderBy(c => StringUtilities.LabelCompare(c.TextValue, paramName));
        	var best = orderedCandidates.FirstOrDefault();
        	int bestDistance;
        	
        	if (best == null || !StringUtilities.IsTextCloseEnough(best.TextValue, paramName, out bestDistance))
        	{
        		if (throwOnMissing)
        		{
	        		Report.Snapshot(repo.FormMAP120.MDI_Form.FeatureScrollViewer);
	        		Report.Failure("dMAP120", "Could not find label '" + paramName + "'");
	        		throw new RanorexException("Could not find label '" + paramName + "'");
        		}
        		else
        		{
        			return null;
        		}
        	}
        	
        	if (bestDistance == 0)
        		Report.Info("dMAP120", "Selected label '" + best.TextValue + "' for parameter '" + paramName + "' (exact match)");
        	else
        		Report.Info("dMAP120", "Selected label '" + best.TextValue + "' for parameter '" + paramName + "' (fuzzy match, distance " + bestDistance.ToString() + ")");
        	
        	return best;
        }
Error was reported in the function:
//
 private object FindControlForParamName(string paramName, bool enabledOnly = true, bool throwOnMissing = true)
        {
        	paramName = ReplaceVariables(paramName);
        	string[] parts = paramName.Split('|');
        	
        	// Check if there is a match for the automationID.
        	foreach (string part in parts)
        	{
        		object control = FindControlForID(part.Trim(), enabledOnly);
        		if (control != null)
        			return control;
        	}
        	
        	// Check if there is a match for label text
        	foreach (string part in parts)
        	{
        		Ranorex.Text label = FindLabelForParameter(part.Trim(), throwOnMissing);
        		
        		if (label != null)
        		{
	        		object control = FindControlForLabel(label, enabledOnly);
	        		if (control != null)
	        			return control;
        		}
        	}
        	
        	if (throwOnMissing)
        	{
	    		Report.Snapshot(repo.FormMAP120.MDI_Form.FeatureScrollViewer);
	    		Report.Failure("FindControlForParamName", "Could not find control for parameter '" + paramName + "'");
	    		throw new RanorexException("Could not find control for parameter '" + paramName + "'");
        	}
        	else
        	{
        		return null;
        	}
        }
Attachments
AUT Snapshot.rxsnp
(522.1 KiB) Downloaded 78 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: .NET application (AUT) blacks out when recording is run

Post by Support Team » Thu Oct 02, 2014 4:47 pm

Hi anupama.sasi,

May I ask you which code was executed right before the application blacks out?
Was it the Report.Snapshot(...) code?
If so, may I also ask you if you could create a snapshot with Microsoft UI Spy of the same element(repo.FormMAP120.MDI_Form.FeatureScrollViewer)? To create a snapshot with UI Spy just select the specific element and click on File -> Save Snapshot from Current View.
Does your application also blacks out when you create a snapshot with UI Spy or when you track different elements with it?

Thanks,
Markus
.
Image