Test runs, but during debugging or teardown I get "A session is either terminated or not started"

I have a device linked with USB, and can launch the app and interact with it by means of C# Appium.

However, on certain occassions I’m getting the “A session is either terminated or not started” error.

  • During debugging oftentimes at the breakpoint
  • When calling the driver’s PageSource during the test, or in the teardown step.

Any typical cause for this?

Timeout… if you dont do anything more then timeout time (default 1min. I can be wrong) appium server will stop running.

I didn’t change the default time, but I’m certainly debugging way quicker than that.
Dito for the PageSource being read during the test.

Also, upon checking the Appium Server logs: the log of ‘shutting down because we waited 60 seconds for a command’ appears over 30 seconds after my test threw the exception. So it’s definitely not a time-out issue.