How to Fix 'Out of memory exceptions' in desktop application tests using CodedUI












0















I'm working on CodedUI(VS2015) for testing a windows application. I have around 318 test cases that are executed using the Ordered test. The script will execute and show how many test cases failed or passed but for the last few executions, execution are blocked in between. Complete execution is not done and Out of memory exeption is shown in stack trace. Each time I execute script is stopped at different test cases.



This issue exists for all versions of the windows application now. Tried executing in 8GB as well as 16GB RAM configurations, still the issue was there.



Expected: Script should either pass or run.
Actual: Result29 Message: Error calling Initialization method for test class
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.


I am using ordered test for script execution and the scripts are failed in between. previously scripts were running properly.



Stacktrace:
please find the stacktrace got after execution. I got many exceptions like this after the test run.



Result148 Name: 290- TC_747174_Cash_A_Check_DataValidation_CheckID_OnUsDetails_1 (cashacheck2)
Result148 Outcome: Failed
Result148 Duration: 0:00:00.0245286
Result148 StackTrace:
at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark)
at System.Threading.Thread.Start(StackCrawlMark& stackMark)
at System.Threading.Thread.Start()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaWorker.StartWorkerThread()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaTechnologyManager.StartSession(Boolean recordingSession)
at Microsoft.VisualStudio.TestTools.UITest.Framework.UITestPluginManager.<>c__DisplayClass1_0.b__0(UITechnologyManager manager)
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )
Result148 Message: Error calling Initialization method for test class UltraDataAutomation.TestCases.CheckList_MemberTransactionsFeature: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.










share|improve this question

























  • Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more.

    – Thangadurai
    Jan 2 at 5:15











  • It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish.

    – AdrianHHH
    Jan 2 at 10:41











  • Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage.

    – Wim Coenen
    Jan 3 at 14:53













  • BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB.

    – Wim Coenen
    Jan 3 at 15:02













  • 1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception?

    – Damien_The_Unbeliever
    Jan 3 at 15:24
















0















I'm working on CodedUI(VS2015) for testing a windows application. I have around 318 test cases that are executed using the Ordered test. The script will execute and show how many test cases failed or passed but for the last few executions, execution are blocked in between. Complete execution is not done and Out of memory exeption is shown in stack trace. Each time I execute script is stopped at different test cases.



This issue exists for all versions of the windows application now. Tried executing in 8GB as well as 16GB RAM configurations, still the issue was there.



Expected: Script should either pass or run.
Actual: Result29 Message: Error calling Initialization method for test class
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.


I am using ordered test for script execution and the scripts are failed in between. previously scripts were running properly.



Stacktrace:
please find the stacktrace got after execution. I got many exceptions like this after the test run.



Result148 Name: 290- TC_747174_Cash_A_Check_DataValidation_CheckID_OnUsDetails_1 (cashacheck2)
Result148 Outcome: Failed
Result148 Duration: 0:00:00.0245286
Result148 StackTrace:
at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark)
at System.Threading.Thread.Start(StackCrawlMark& stackMark)
at System.Threading.Thread.Start()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaWorker.StartWorkerThread()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaTechnologyManager.StartSession(Boolean recordingSession)
at Microsoft.VisualStudio.TestTools.UITest.Framework.UITestPluginManager.<>c__DisplayClass1_0.b__0(UITechnologyManager manager)
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )
Result148 Message: Error calling Initialization method for test class UltraDataAutomation.TestCases.CheckList_MemberTransactionsFeature: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.










share|improve this question

























  • Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more.

    – Thangadurai
    Jan 2 at 5:15











  • It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish.

    – AdrianHHH
    Jan 2 at 10:41











  • Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage.

    – Wim Coenen
    Jan 3 at 14:53













  • BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB.

    – Wim Coenen
    Jan 3 at 15:02













  • 1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception?

    – Damien_The_Unbeliever
    Jan 3 at 15:24














0












0








0








I'm working on CodedUI(VS2015) for testing a windows application. I have around 318 test cases that are executed using the Ordered test. The script will execute and show how many test cases failed or passed but for the last few executions, execution are blocked in between. Complete execution is not done and Out of memory exeption is shown in stack trace. Each time I execute script is stopped at different test cases.



This issue exists for all versions of the windows application now. Tried executing in 8GB as well as 16GB RAM configurations, still the issue was there.



Expected: Script should either pass or run.
Actual: Result29 Message: Error calling Initialization method for test class
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.


I am using ordered test for script execution and the scripts are failed in between. previously scripts were running properly.



Stacktrace:
please find the stacktrace got after execution. I got many exceptions like this after the test run.



Result148 Name: 290- TC_747174_Cash_A_Check_DataValidation_CheckID_OnUsDetails_1 (cashacheck2)
Result148 Outcome: Failed
Result148 Duration: 0:00:00.0245286
Result148 StackTrace:
at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark)
at System.Threading.Thread.Start(StackCrawlMark& stackMark)
at System.Threading.Thread.Start()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaWorker.StartWorkerThread()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaTechnologyManager.StartSession(Boolean recordingSession)
at Microsoft.VisualStudio.TestTools.UITest.Framework.UITestPluginManager.<>c__DisplayClass1_0.b__0(UITechnologyManager manager)
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )
Result148 Message: Error calling Initialization method for test class UltraDataAutomation.TestCases.CheckList_MemberTransactionsFeature: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.










share|improve this question
















I'm working on CodedUI(VS2015) for testing a windows application. I have around 318 test cases that are executed using the Ordered test. The script will execute and show how many test cases failed or passed but for the last few executions, execution are blocked in between. Complete execution is not done and Out of memory exeption is shown in stack trace. Each time I execute script is stopped at different test cases.



This issue exists for all versions of the windows application now. Tried executing in 8GB as well as 16GB RAM configurations, still the issue was there.



Expected: Script should either pass or run.
Actual: Result29 Message: Error calling Initialization method for test class
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.


I am using ordered test for script execution and the scripts are failed in between. previously scripts were running properly.



Stacktrace:
please find the stacktrace got after execution. I got many exceptions like this after the test run.



Result148 Name: 290- TC_747174_Cash_A_Check_DataValidation_CheckID_OnUsDetails_1 (cashacheck2)
Result148 Outcome: Failed
Result148 Duration: 0:00:00.0245286
Result148 StackTrace:
at System.Threading.Thread.StartInternal(IPrincipal principal, StackCrawlMark& stackMark)
at System.Threading.Thread.Start(StackCrawlMark& stackMark)
at System.Threading.Thread.Start()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaWorker.StartWorkerThread()
at Microsoft.VisualStudio.TestTools.UITest.Extension.Uia.UiaTechnologyManager.StartSession(Boolean recordingSession)
at Microsoft.VisualStudio.TestTools.UITest.Framework.UITestPluginManager.<>c__DisplayClass1_0.b__0(UITechnologyManager manager)
at System.Threading.Tasks.Parallel.<>c__DisplayClass42_0`2.b__1()
at System.Threading.Tasks.Task.InnerInvoke()
at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask)
at System.Threading.Tasks.Task.<>c__DisplayClass176_0.b__0(Object )
Result148 Message: Error calling Initialization method for test class UltraDataAutomation.TestCases.CheckList_MemberTransactionsFeature: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.







c# windows coded-ui-tests specflow ordered-test






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 16 at 9:34







user3483878

















asked Jan 2 at 5:08









user3483878user3483878

11




11













  • Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more.

    – Thangadurai
    Jan 2 at 5:15











  • It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish.

    – AdrianHHH
    Jan 2 at 10:41











  • Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage.

    – Wim Coenen
    Jan 3 at 14:53













  • BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB.

    – Wim Coenen
    Jan 3 at 15:02













  • 1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception?

    – Damien_The_Unbeliever
    Jan 3 at 15:24



















  • Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more.

    – Thangadurai
    Jan 2 at 5:15











  • It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish.

    – AdrianHHH
    Jan 2 at 10:41











  • Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage.

    – Wim Coenen
    Jan 3 at 14:53













  • BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB.

    – Wim Coenen
    Jan 3 at 15:02













  • 1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception?

    – Damien_The_Unbeliever
    Jan 3 at 15:24

















Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more.

– Thangadurai
Jan 2 at 5:15





Try some memory profiling tool (Redgate memory profiler, etc.) to see what is consuming more.

– Thangadurai
Jan 2 at 5:15













It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish.

– AdrianHHH
Jan 2 at 10:41





It would appear that some part of the tests are allocating memory but not releasing it. I would look at your test cases first, perhaps they are not releasing UiTestControl objects when test cases finish.

– AdrianHHH
Jan 2 at 10:41













Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage.

– Wim Coenen
Jan 3 at 14:53







Do your tests use global (static) variables? Those act as roots that prevent the referenced objects from becoming collectable garbage.

– Wim Coenen
Jan 3 at 14:53















BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB.

– Wim Coenen
Jan 3 at 15:02







BTW, the reason 8GB or 16GB doesn't make a difference is because CodedUI test code always runs in a 32-bit process. (Not to be confused with the process of the application under test itself, which is separate from the CodedUI test runner and can be 64-bit.) I believe 32-bit .NET processes can only use 2GB. Maybe a bit more but certainly less than 4GB.

– Wim Coenen
Jan 3 at 15:02















1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception?

– Damien_The_Unbeliever
Jan 3 at 15:24





1) Usable address space in your process is the important measure, not the amount of physical ram and 2) unhelpfully, there are a number of components (I'm looking at System.Drawing) that will throw OutOfMemory exceptions if they've exhausted their short list of "likely" error situations, so it may have nothing to do with memory/address space at all. Can you get a stack trace for that exception?

– Damien_The_Unbeliever
Jan 3 at 15:24












1 Answer
1






active

oldest

votes


















0














There can be many possible causes, for example maybe you're allocating memory inside loops and not freeing it up properly. Same problem can happen if you are opening many data connections and not closing/disposing them properly.






share|improve this answer
























  • Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

    – user3483878
    Jan 4 at 10:39













  • In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

    – Naeem A. Malik
    Jan 4 at 15:15











  • Thankyou. I will check that way.

    – user3483878
    Jan 7 at 5:38











  • I checked with the older version. it is also having the same issue and execution is stopped in between.

    – user3483878
    Jan 16 at 9:44











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001476%2fhow-to-fix-out-of-memory-exceptions-in-desktop-application-tests-using-codedui%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














There can be many possible causes, for example maybe you're allocating memory inside loops and not freeing it up properly. Same problem can happen if you are opening many data connections and not closing/disposing them properly.






share|improve this answer
























  • Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

    – user3483878
    Jan 4 at 10:39













  • In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

    – Naeem A. Malik
    Jan 4 at 15:15











  • Thankyou. I will check that way.

    – user3483878
    Jan 7 at 5:38











  • I checked with the older version. it is also having the same issue and execution is stopped in between.

    – user3483878
    Jan 16 at 9:44
















0














There can be many possible causes, for example maybe you're allocating memory inside loops and not freeing it up properly. Same problem can happen if you are opening many data connections and not closing/disposing them properly.






share|improve this answer
























  • Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

    – user3483878
    Jan 4 at 10:39













  • In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

    – Naeem A. Malik
    Jan 4 at 15:15











  • Thankyou. I will check that way.

    – user3483878
    Jan 7 at 5:38











  • I checked with the older version. it is also having the same issue and execution is stopped in between.

    – user3483878
    Jan 16 at 9:44














0












0








0







There can be many possible causes, for example maybe you're allocating memory inside loops and not freeing it up properly. Same problem can happen if you are opening many data connections and not closing/disposing them properly.






share|improve this answer













There can be many possible causes, for example maybe you're allocating memory inside loops and not freeing it up properly. Same problem can happen if you are opening many data connections and not closing/disposing them properly.







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 3 at 14:48









Naeem A. MalikNaeem A. Malik

701314




701314













  • Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

    – user3483878
    Jan 4 at 10:39













  • In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

    – Naeem A. Malik
    Jan 4 at 15:15











  • Thankyou. I will check that way.

    – user3483878
    Jan 7 at 5:38











  • I checked with the older version. it is also having the same issue and execution is stopped in between.

    – user3483878
    Jan 16 at 9:44



















  • Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

    – user3483878
    Jan 4 at 10:39













  • In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

    – Naeem A. Malik
    Jan 4 at 15:15











  • Thankyou. I will check that way.

    – user3483878
    Jan 7 at 5:38











  • I checked with the older version. it is also having the same issue and execution is stopped in between.

    – user3483878
    Jan 16 at 9:44

















Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

– user3483878
Jan 4 at 10:39







Script has been executed successfully these days, only now the issue started appearing. So dont think its a memory allocation issue within loops. Also i am not using any DB connections.

– user3483878
Jan 4 at 10:39















In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

– Naeem A. Malik
Jan 4 at 15:15





In that case maybe reverting to an older version will help. Sometimes we do make small changes that have big effects unknowingly.

– Naeem A. Malik
Jan 4 at 15:15













Thankyou. I will check that way.

– user3483878
Jan 7 at 5:38





Thankyou. I will check that way.

– user3483878
Jan 7 at 5:38













I checked with the older version. it is also having the same issue and execution is stopped in between.

– user3483878
Jan 16 at 9:44





I checked with the older version. it is also having the same issue and execution is stopped in between.

– user3483878
Jan 16 at 9:44




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54001476%2fhow-to-fix-out-of-memory-exceptions-in-desktop-application-tests-using-codedui%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

How to fix TextFormField cause rebuild widget in Flutter

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith