thanks for the reply.
The tests don't use the AtomicAttribute. We are using Specflow which is using MSTest as the testing framework. The [BeforeTestSetup] methods generally do some process killing to make sure any process hanging around from a previous test run is killed before we start. they also do a bit of config file manipulation for the application we are going to start. In the [BeforeScenario] methods we again kill some processes, if they are alive, start video recording of the test and do a bit of setup. None of it looks 'long' particularly to me, though I suppose sometimes it might take a while for processes to die. I'm not sure what you define as 'long running code' here. We could instrument this time and log it, if that would help diagnose?
Like I said this doesn't happen all the time, just occasionally. I have more examples, if that would help and could potentially provide build logs if required