This is a migrated thread and some comments may be shown as answers.

Ignore ThreadAbortException

7 Answers 244 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Alex
Top achievements
Rank 1
Alex asked on 29 Jun 2010, 12:34 PM
After every test I run with WebAii as soon as I close the browser or clean up the test I get the following exception :

---- UNHANDLED EXCEPTION ----<BR>Thread Name:   
RemotedAsyncCommandListener<BR>System.Threading.ThreadAbortException: Thread was   
being aborted.<BR>&nbsp;&nbsp; at   
ArtOfTest.WebAii.Messaging.Process.BrowserRemoted.AsyncListener()<BR>&nbsp;&nbsp;   
at System.Threading.ThreadHelper.ThreadStart_Context(Object   
state)<BR>&nbsp;&nbsp; at System.Threading.ExecutionContext.runTryCode(Object   
userData)<BR>&nbsp;&nbsp; at   
System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode   
code, CleanupCode backoutCode, Object userData)<BR>&nbsp;&nbsp; at   
System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext,   
ContextCallback callback, Object state)<BR>&nbsp;&nbsp; at   
System.Threading.ExecutionContext.Run(ExecutionContext executionContext,   
ContextCallback callback, Object state, Boolean ignoreSyncCtx)<BR>&nbsp;&nbsp;   
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext,   
ContextCallback callback, Object state)<BR>&nbsp;&nbsp; at   
System.Threading.ThreadHelper.ThreadStart() 



I get this even though the test itself has passed.

I would like to hide this exception or at least not display in the console.writeline as it suggests the test has failed when it has not.

I have tried playing with various settings including lots of configurations like

 

 

Settings settings = GetSettings();

 

settings.EnableSilverlight =

 

true;

 

settings.CreateLogFile =

 

false;

 

Initialize(settings);

I have also tried catching the ThreadAbortException but it seems this is already being caught inside the WebAii internals and then the above log gets written each time.

7 Answers, 1 is accepted

Sort by
0
Missing User
answered on 30 Jun 2010, 11:17 PM
Hello Alex,

Are you using TestDriven.NET, Reflector or Resharper add ons for Visual Studio? If so, there seems to be conflicts with those in that they do not seem to allow WebAii tests to exit gracefully.

Sincerely,
Nelson Sin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alex
Top achievements
Rank 1
answered on 01 Jul 2010, 09:32 AM
Thanks for the reply - yes we are using TestDriven.NET with NUnit.

Is there any way to suppress these warning messages as they make the log output difficult to read with lots of irrelevant exceptions.
0
Missing User
answered on 02 Jul 2010, 05:49 PM
Hi again Alex,

If I remember correctly, I believe that exception is thrown on test clean up/ tear down. If you are using the WebAii NUnit test template, then it is thrown in either MyTestCleanUp() or FixtureCleanup() method.

If you are using custom code, then I think it will occur then you call Manager.Dispose(). Please try catching the exception in those respective lines.

All the best,
Nelson
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Alex
Top achievements
Rank 1
answered on 08 Jul 2010, 01:48 PM
Thanks,

I tried this but still no exception was caught :

         try
         {
            test.Manager.Dispose();
         }
         catch (Exception e)
         {
         }

This still appeared in the Test log :

---- UNHANDLED EXCEPTION ----
Thread Name: RemotedAsyncCommandListener
System.Threading.ThreadAbortException: Thread was being aborted.
   at ArtOfTest.WebAii.Messaging.Process.BrowserRemoted.AsyncListener()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()
0
Missing User
answered on 12 Jul 2010, 09:20 PM
Hi again Alex,

I'm having trouble reproducing this problem locally in that the NUnit test I created is not throwing the error. Could you reply back with a sample NUnit test along with any setup/teardown you are doing that is throwing the error?

Kind regards,
Nelson
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mario
Top achievements
Rank 1
answered on 15 Mar 2011, 09:13 PM
I receive this error when running the SampleWebAiiTest using TDD .NET and setting the browser to "FireFox" in the App.config setting.

Here is the sample test:

[Test]
public void SampleWebAiiTest()
{
    // Launch a browser instance
    Manager.LaunchNewBrowser();
 
    // The active browser
    ActiveBrowser.NavigateTo("http://www.google.com");
 
    // Find the google search box and set it to "Telerik";
    Find.ByName<HtmlInputText>("q").Text = "Telerik";
 
    // Click the Search button
    Find.ByName<HtmlInputSubmit>("btnG").Click();
 
    // Validate the search contain the 'Telerik' text
    Assert.IsTrue(ActiveBrowser.ContainsText("Telerik"));
}

The exception seems to happen on a separate thread from the one executing our test code. Let me know if you need any more information.

Firefox version 3.6.6; Windows 7; VS 2008 with R# installed; TDD .NET 3.0
0
Stoich
Telerik team
answered on 22 Mar 2011, 01:08 PM
Hello Mario,
    use MouseClick() instead of Click() like this:
Find.ByName<HtmlInputSubmit>("btnG").MouseClick();
We've noticed some problems with Firefox and the Click() method (There's currently a bug filed on this).

Don't use ActiveBrowser.ContainsText(). Instead get the actual element who's content you want to search.

Let me know if the code still doesn't work after implementing these changes!

Kind regards,
Stoich
the Telerik team
Tags
General Discussions
Asked by
Alex
Top achievements
Rank 1
Answers by
Missing User
Alex
Top achievements
Rank 1
Mario
Top achievements
Rank 1
Stoich
Telerik team
Share this question
or