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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 242k
  • Answers 242k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer When you click the button, it sends a POST request… May 13, 2026 at 7:34 am
  • Editorial Team
    Editorial Team added an answer I'm assuming you're making a game, if you aren't ignore… May 13, 2026 at 7:34 am
  • Editorial Team
    Editorial Team added an answer By default, no, global variables are not shared across processes.… May 13, 2026 at 7:34 am

Related Questions

My aim is to restore an Oracle database back to it's previous state after
My aim: to continue a web session across an app interruption (eg. incoming SMS
I'm looking for some help/suggestions for backing up two large databases to one server
My aim is to create nested resources via one REST request. The REST requests
my aim is to invoke a shell script from a PHP program and then

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.