tcunit / TcUnit-Runner

Program that makes it possible to automate runs of TcUnit unit tests
Other
34 stars 17 forks source link

TcUnit-Runner zombie instance of only solution is loaded #27

Closed sagatowski closed 1 year ago

sagatowski commented 3 years ago

Describe the bug Under certain circumstances a zombie instance of the TcXaeShell (or whatever IDE is being used) can be left. The problem is here:

LoadSolution(@filePath);
LoadProject();
loaded = true;

If the solution is correctly loaded but the project not, we will have one instance of the xaeshell running dead as its not properly cleaned up:

/// <summary>
/// Closes the DTE and makes sure the VS process is completely shutdown
 /// </summary>
        public void Close()
        {
            if (loaded) {
               ...
                dte.Quit();
            }
            loaded = false;
        }

Suggestion is to simply move loaded:

LoadSolution(@filePath);
loaded = true;
LoadProject();

I would also rename it solutionLoaded

Software versions TcUnit-Runner 0.9.3

Run environment TcXaeShell 3.1.4024.15

densogiaichned commented 3 years ago

Why not just use

public void Close()
{
  if (dte == null)
      return;

  log.Info("Closing the Visual Studio Development Tools Environment (DTE)...");
  Thread.Sleep(20000); // Avoid 'Application is busy'-problem (RPC_E_CALL_REJECTED 0x80010001 or RPC_E_SERVERCALL_RETRYLATER 0x8001010A)
  dte.Quit();
}

and ditch the field loaded, IMHO not necessary, or am i missing something?

sagatowski commented 3 years ago

You're right, this is how I actually ended up fixing this.