Out of memory during repository generation

Bug reports.
LeonP
Posts: 5
Joined: Tue Dec 07, 2010 9:49 pm

Out of memory during repository generation

Post by LeonP » Tue Dec 14, 2010 9:36 pm

I am working with large data tables and was building a repository column by column (each column is a large data table).

I was already limiting the repository to only 3 columns, but still got this out of memory exception.
For earlier trials I let Ranorex decide which repository elements to include while capturing a manual test, but this resulted in items that I needed to reference in user code missing from the repository.

Can this be fixed?

Thanks,

Leon

Ranorex Studio Version : 2.3.5.10317
.NET Version : 2.0.50727.4952
OS Version : Microsoft Windows NT 6.1.7600.0
Current culture : English (United States) (en-US)
Running under WOW6432, processor architecture: AMD64
Working Set Memory : 1039048kb
GC Heap Memory : 912751kb

Exception thrown:
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at System.String.GetStringForStringBuilder(String value, Int32 startIndex, Int32 length, Int32 capacity)
at System.Text.StringBuilder.GetNewString(String currentString, Int32 requiredLength)
at System.Text.StringBuilder.Append(String value)
at Ranorex.Core.FastXml.XmlNode.PrintNode(StringBuilder text, XmlNode node, String indent)
at Ranorex.Core.FastXml.XmlNode.PrintNode(StringBuilder text, XmlNode node, String indent)
at Ranorex.Core.FastXml.XmlNode.PrintNode(StringBuilder text, XmlNode node, String indent)
at Ranorex.Core.FastXml.XmlNode.PrintNode(StringBuilder text, XmlNode node, String indent)
at Ranorex.Core.FastXml.XmlNode.PrintNode(StringBuilder text, XmlNode node, String indent)
at Ranorex.Core.FastXml.XmlNode.PrintNode(StringBuilder text, XmlNode node, String indent)
at Ranorex.Core.FastXml.XmlNode.ToXmlString()
at Ranorex.Core.Repository.ElementRepository.CreateMemento()
at Ranorex.Core.Repository.ElementRepository.ComputeChangeStateHash()
at Ranorex.Core.Repository.ElementRepository.get_IsDirty()
at Ranorex.Controls.RepositoryEditor.OnRepositoryChanged(Boolean doUpdate, Boolean updateUndo)
at Ranorex.Controls.RepositoryEditor.SaveRepositoryFile(Boolean forceSaveAs, Stream stream, Boolean catchErrors)
at Ranorex.Controls.RepositoryEditor.SaveRepositoryFile(Boolean forceSaveAs, Boolean catchErrors)
at Ranorex.Addins.ElementTree.AddToRepositoryInclSubNodes(RepositoryEditor repositoryEditor, ElementInfo info)
at Ranorex.Addins.ElementTree.elementTree_RequestRepositoryExportInclSubNodes(Object sender, EventArgs e)
at Ranorex.Controls.ElementTreeAdv.OnRequestRepositoryExportSubNodes(EventArgs e)
at Ranorex.Controls.ElementTreeAdv.toolStripMenuItem1_Click(Object sender, EventArgs e)
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripMenuItem.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.ToolStripDropDown.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.ToolStripDropDown.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

---- Recent log messages:
Failed to append recent log messages.
System.InvalidOperationException: Sequence contains no elements
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)
at ICSharpCode.SharpDevelop.Sda.LogMessageRecorder.AppendRecentLogMessages(StringBuilder sb, ILog log)
at ICSharpCode.SharpDevelop.Sda.ExceptionBox.getClipboardString()

---- Post-error application state information:
Installed 3rd party AddIns: [RxLogViewer 2.3.5.10317], [RxObjectRepository 2.3.5.10317], [RxRecorder 2.3.5.10317], [Workflow Foundation Designer 2.3.5.10317], [ElementTree 2.3.5.10317]
Workbench.ActiveContent: Ranorex.Addins.ElementTreePad
ProjectService.OpenSolution: [Solution: FileName=C:\Users\leonp\Documents\RanorexStudio Projects\Repotest\Repotest.rxsln, HasProjects=True, ReadOnly=False]
ProjectService.CurrentProject: [CSharpProject: Repotest]

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

Re: Out of memory during repository generation

Post by Support Team » Tue Dec 14, 2010 10:14 pm

How you you add items to the repository? Using the "Add to Repository (incl. children)" context menu entry?
How many elements are you trying to add and how many items are in your repository already?

BTW you don't need to have every element in the repository. For example, if you want to iterate through all cells of a table, it's much easier to only add the table element to the repository and then use the "Columns" and "Rows" properties of the table element to iterate through columns/rows and their cells.

A similar approach is creating a repository element that corresponds to all rows and then use the RepoItemInfo.CreateAdapters method to get all the corresponding elements at once.

Regards,
Alex
Ranorex Team
.
Image

LeonP
Posts: 5
Joined: Tue Dec 07, 2010 9:49 pm

Re: Out of memory during repository generation

Post by LeonP » Thu Dec 16, 2010 3:32 pm

Alex,

Thanks for the suggestions.

Yes, I was using the "Add to Repository (incl. children)" context menu entry, but only for the part of the UI which displays several tables. I am comparing/trialing a few test tools and the fact that Ranorex reads in both the visible and non-visible part of the table caught me by surprise. The tables I need to access are all ComponentOne elements with MSAA enabled.

Ranorex recognizes the tables as "ContainerDeltaGrid" which does not have "Rows" or "Column" properties.

I must admit I do not have the level of sophistication at this point to try RepoItemInfo.CreateAdapters.

I would appreciate if you could point me to more detailed information to solve this problem. I am impressed with the capabilities of Ranorex, but since ComponentOne grid access is the main part of the UIs I need to test, QTP from HP is the winner.

Leon

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

Re: Out of memory during repository generation

Post by Support Team » Thu Dec 16, 2010 5:08 pm

LeonP wrote:I would appreciate if you could point me to more detailed information to solve this problem.
First I need to know what you are trying to do with the tables. For example, you want to iterate all cells, you want to interact with only one single cell, ...

And a Ranorex snapshot of the application would be a nice help, too. Just attach the Ranorex snapshot to your post or send it directly to support_at_ranorex.com if you don't want to make it available in the forum. See the following section in the Ranorex User Guide on how to create Ranorex snapshots:
http://www.ranorex.com/support/user-gui ... html#c2072

Regards,
Alex
Ranorex Team
.
Image

LeonP
Posts: 5
Joined: Tue Dec 07, 2010 9:49 pm

Re: Out of memory during repository generation

Post by LeonP » Fri Dec 17, 2010 6:43 pm

Alex,

I can not sent a snapshot for proprietary reasons, but I think the info below will help.

The screen looks like a simple spreadsheet table with 8 columns and 250 rows of decimal numbers. 40 rows are visible in the user interface.

I learned to drag and drop individual rows from the element browser into the repository.
This is sufficient to capture a manual test where individual cells are selected and subsequently, values in pop-up windows are verified.

The type of test I need to implement goes as follows:
1. read the content of a specific cell or cells in the table
2. based on the value read and some information external to the table, determine the row and column number of the next cell to read
3. read and verify the value in the cell at this calculated address (in row,col format)

Outside information can change, resulting in different rows/cells needing to be examined.

I am used to having indexes available over the visible range.
The fixed names (e.g. CellRow_57_Column_1) are not helpfull.

I included part of the repository.cs file that was generated by Ranorex.
The dataGrid refered to in the repository is a C1FlexGrid from ComponentOne.


Thanks,
Leon

----------------------------------------------------------------------------------------------------------------------------------



/// <summary>
/// Creates a new RowRow_57 folder.
/// </summary>

public RowRow_57Folder(RepoGenBaseFolder parentFolder) :
base("RowRow_57", "tabpagelist/tabpage[@controlname='tabDeltas']/container/container[@controlname='DeltaGrid' and @caption='' and @controltypename='DeltaGrid' and @instance='0']/element[@controlname='dataGrid']/row[@accessiblename='Row 57']", parentFolder, 10000, true)
{
_cellrow_57_column_0Info = new RepoItemInfo(this, "CellRow_57_Column_0", "cell[@accessiblename='Row 57 Column 0']", 10000, null);
_cellrow_57_column_1Info = new RepoItemInfo(this, "CellRow_57_Column_1", "cell[@accessiblename='Row 57 Column 1']", 10000, null);

// lines related to columns 2 through 7 were deleted

_selfInfo = new RepoItemInfo(this, "Self", "", 10000, null);
}

/// <summary>
/// The CellRow_57_Column_0 item.
/// </summary>
public virtual Ranorex.Cell CellRow_57_Column_0
{
get
{
return _cellrow_57_column_0Info.CreateAdapter<Ranorex.Cell>(true);
}
}

/// <summary>
/// The CellRow_57_Column_0 item info.
/// </summary>
public virtual RepoItemInfo CellRow_57_Column_0Info
{
get
{
return _cellrow_57_column_0Info;
}
}

User avatar
Ciege
Ranorex Guru
Posts: 1335
Joined: Thu Oct 16, 2008 6:46 pm
Location: Arizona, USA

Re: Out of memory during repository generation

Post by Ciege » Fri Dec 17, 2010 8:09 pm

Hi Leon,
I would suggest you watch the Ranorex screen casts for RanoreXpath 1 & 2 at http://www.ranorex.com/support/screencasts.html

This will instruct you on how to craft custom XPaths to find the other cells, rows, columns etc... based on the information you determine from your inputs. These screen casts are very useful and (like they did for me) can help open your eyes to more of the power that Ranorex gives us.
If this or any response has helped you, please reply to the thread stating that it worked so other people with a similar issue will know how you fixed your issue!

Ciege...

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

Re: Out of memory during repository generation

Post by Support Team » Mon Dec 20, 2010 11:27 am

Hi,

the code of your test you need to implement may look something like this:
// get the cell after the current cell
Cell following_cell = repo.<yourDataGrid>.current_cell.GetPath().ToString() 
	+ "/following-sibling::cell";

// extract the row and the column out of the previously found cell
int row = /*<string function to get the row out of the cell following_cell>*/;
int col = /*<string function to get the column out of the cell following_cell>*/;

// get the cell which is referenced in previously found cell,
// either building a RanoreXPath 
Cell referenced_cell = repo.<yourDatagrid>.GetPath().ToString() 
	+ "/row[@accessiblename='Row "
	+ row.ToString() + "]/cell[@accessiblename='Row " 
	+ row.ToString()  + " Column " + col.ToString() + "]'";
// or accessing the tables structure
Cell referenced cell = repo.<yourDataGrid>.Rows[row].Cells[col];
To learn more about the RanoreXPath have a look at following links:
http://www.ranorex.com/support/user-gui ... xpath.html
http://www.ranorex.com/blog/ranorexpath-tips-and-tricks
http://www.ranorex.com/support/screencasts.html

Regards,
Tobias
Support Team
.
Image

LeonP
Posts: 5
Joined: Tue Dec 07, 2010 9:49 pm

Re: Out of memory during repository generation

Post by LeonP » Thu Dec 23, 2010 8:07 pm

Thanks!

To address my initial problem of running out of memory, I was able to use the xpath in the element browser to select a subset of the container elements and only move those to the repository. (each of the three containers I need in the repository represents >2K objects).

The code snippets are useful. Because I am working with a third party UI component (ComponentOne) I can only use the text string editing version, not the indexing.

Thanks to all for your suggestions.

Leon