Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 450037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:49:45+00:00 2026-05-12T21:49:45+00:00

My aim is to restore an Oracle database back to it’s previous state after

  • 0

My aim is to restore an Oracle database back to it’s previous state after a lot of unit tests have been run by using flashback recovery using the ClassCleanup attribute.

I have written a batch file + SQL to properly restore the database. This has been tested in my command prompt numerous times without issues

I would normally put the restore as a cleanup script inside the test run configuration, however I need to include a time to flashback the database to (set on the ClassInitialize)

        try
        {
            ProcessStartInfo startInfo = new ProcessStartInfo(@"SomeProjectDirectory\flashback.bat");                
            startInfo.CreateNoWindow = false;                
            startInfo.WindowStyle = ProcessWindowStyle.Normal;
            startInfo.ErrorDialog = true;                
            startInfo.Arguments = Arguments;
            startInfo.UseShellExecute = true;                                                

            Process batchExecute = new Process();
            batchExecute.StartInfo = startInfo;
            batchExecute.Start();
            batchExecute.WaitForExit();
        }
        catch (Exception e)
        {
            System.Diagnostics.Debug.WriteLine(e.ToString());
        }

The batch file is executed fine but the problem seems to be that the ClassCleanup method times out before it has finished

It does not hit any breakpoints or catch any exceptions after the WaitForExit(). It simply exits the command prompt window halfway through the process and lets me know all the tests succeeded with no error message.

I tried adding a Timeout attribute to the ClassCleanup method with a large number but this doesn’t seem to help either. This attribute I am fairly certain is only applicable to a unit test not the class cleanup

I moved the process into the TestCleanup method and it worked without a problem. The process also ran fine inside a Test. It only seems to timeout in the ClassCleanup & AssemblyCleanup methods

I am under the impression that is a timeout because everytime we run the test, it always drops out at the same point, however if we add or remove steps to the script, it will drop out earlier or later than normal

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:49:45+00:00Added an answer on May 12, 2026 at 9:49 pm

    I’ve had the same problem. The reason this happens is because of the GC that’s going on at the background when ClassCleanup and AssemblyCleanup are being executed. So if you try to access resources outside of the scope of the Cleanup function, more likely than not they’ll be garbage collected and the function will quit without throwing an exception.

    You can remedy the problem by putting all necessary code in to the Cleanup functions or make local copies of them at the very beginning of the class (which is a bit of a hack). However, this can be tricky with Client-Server applications. You might need to bring in some low-level code in to this function to make this work.

    Personally I don’t appreciate this design decision, because it makes life much harder than it needs to be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My aim is to have package restore working on a build server so that
Aim The aim is to a have a container DIV with a fixed height
hi i am integrating authorize.net AIM api into my shopping cart. i have a
My aim is have the text inside this div displaying in the middle of
my aim is to reverse an array 3,12,2,1 to 1,2,12,3. when i run this
Aim: To have the if statement execute a onclick event through code. I currently
My aim is to have a simple, form based CMS so the client can
My aim is to have a <div> with a fixed size (dynamically set through
my aim is to import some certain data to the database of a Grails
Aim to Achieve : I want to have 3 different dataTables from 3 different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.