jcansdale / TestDriven.Net-Issues

Issue tracking for TestDriven.Net
https://github.com/jcansdale/TestDriven.Net-Issues/issues
24 stars 2 forks source link

Adhoc in Core - Debug/Stop does not stop execution immediately #155

Open jimnkey opened 3 years ago

jimnkey commented 3 years ago

Not sure if this is a know issue/behavior or NetCore (3.1) is not going to be supported any time soon... but debugging execution of an adhoc method doesn't stop when expected.

        public void TestMethod1()
        {
            Console.WriteLine("Set a breakpoint on this line");
            Console.WriteLine("Entire test method will execute regardless of stopping debug mode");
        }

Expected: To stop before/at the break point.

jcansdale commented 3 years ago

Hello 👋

Not sure if this is a know issue/behavior or NetCore (3.1) is not going to be supported any time soon... but debugging execution of an adhoc method doesn't stop when expected.

This is actually the way TestDriven.NET worked for a while. Test With > Debugger is the same as Run Test(s), except it attaches the debugger before starting the tests.

It's actually difficult to stop a test run in a clean way. Most test frameworks don't support a way to signal an abort and attempting to kill a thread is a minefield. Allowing the thread to continue and giving dispose/resource cleanup a chance to complete seems to be the least worst option.

I hope that makes sense. 😄

jimnkey commented 3 years ago

As a work around - we seem to be able to 'End Task' in Task Manager for the '.NET Host' running under the corresponding VS processes tree.

If this can be done manually, I'm thinking there's a chance it can be done within the test runner: to kill/stop the .NET Host that it started? Maybe you've already thought of this and it wasn't viable?

As a side -- any plans of open sourcing to progress for .NET5 or 2022 and beyond?