Ignore ThreadAbortException

8 posts, 0 answers
  1. Alex
    Alex avatar
    8 posts
    Member since:
    May 2009

    Posted 29 Jun 2010 Link to this post

    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.
  2. Missing user
    Missing user avatar

    Posted 30 Jun 2010 Link to this post

    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
  3. Alex
    Alex avatar
    8 posts
    Member since:
    May 2009

    Posted 01 Jul 2010 Link to this post

    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.
  4. Missing user
    Missing user avatar

    Posted 02 Jul 2010 Link to this post

    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
  5. Alex
    Alex avatar
    8 posts
    Member since:
    May 2009

    Posted 08 Jul 2010 Link to this post

    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()
  6. Missing user
    Missing user avatar

    Posted 12 Jul 2010 Link to this post

    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
  7. Mario
    Mario avatar
    1 posts
    Member since:
    Dec 2010

    Posted 15 Mar 2011 Link to this post

    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
  8. Stoich
    Admin
    Stoich avatar
    1 posts

    Posted 22 Mar 2011 Link to this post

    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
Back to Top