Home > Net >  Visual Studio MSTest doesn't stop on breakpoint when [ClassInitialize] tag present
Visual Studio MSTest doesn't stop on breakpoint when [ClassInitialize] tag present

Time:11-14

On my first MSTest project (VS2015) I encountered the following problem, if I have

    [ClassInitialize]
    public void Exe20_Run()
    {
    }

The debugger doesn't stops on breakpoints. The debugger will stop on breakpoints if I change it to

    [TestInitialize]
    public void Exe20_Run()
    {
    }

So, I guess that for some reason, the [ClassInitialize] damages the debugger functionality... I need the [ClassInitialize] but also debugging capability is wanted.

Could you please help?

Thanks, Liat

CodePudding user response:

For [ClassInitialise] you don't have the correct signature. Try the following:

    [ClassInitialize]
    public static void Exe20_Run(TestContext t)
    {
        System.Console.WriteLine("YO!");
    }

Add your breakpoint, go to Test menu -> "debug all tests" (or CTRL-R, CTRL-A) and it should stop.

  • Related