VS2012 Breakpoints are not getting hit

后端 未结 24 1638
小鲜肉
小鲜肉 2020-12-13 12:44

I have a class that looks like this:

public class MyService
{
    private MyService(){}
    public static string GetStuff()
    {
        var stuffDid = new          


        
相关标签:
24条回答
  • 2020-12-13 13:22

    You need to make DoStuff static.

    private static string DoStuff()
    {
        //do stuff
    }
    
    0 讨论(0)
  • 2020-12-13 13:22

    I ran into a similar issue. It turned out that for me it was a bad migration from VS2010 to VS2012 with the *.testrunconfig file. I deleted the old one and set up a new one to resolve the issue.

    0 讨论(0)
  • 2020-12-13 13:22

    Some more stuff to try:

    • Check if the loaded symbols match the debugged executable:
      Open a VS command prompt and cd to the directory where the executable you debug resides. Then do a dumpbin /PDBPATH:VERBOSE MyServiceExecutable.exe and scan the output for "PDB age mismatch" (Ref: http://msdn.microsoft.com/en-us/library/44wx0fef.aspx)

    • Not sure about VS 2012, but older versions of VS had a bug where the wrong source file would be displayed, provided that you have two source files in your project that have the same name, even when they are located in different folders. So if your project contains another source file with the same name, see if renaming one of them helps. (Update: Seems VS 2012 is affected too.)

    0 讨论(0)
  • 2020-12-13 13:23

    This sounds like the pdb files are not updated in your test sandbox.

    1) Ensure that you are in debug mode.

    2) Can you try and include a deployment item for the pdb files explicitly?

    • You said that you can attach a debug point in your test project.
    • Once you have hit the debug point in your test project , check to make sure the pdb files with the latest time stamp is present in the Out folder of your sandbox.

    3) If 1 and 2 fail , I have found that sometimes visual studio requires a restart :)

    0 讨论(0)
  • 2020-12-13 13:25

    If it is in release mode switch it to debug mode.

    0 讨论(0)
  • 2020-12-13 13:27

    You could try to add a Thread.Sleep(5000) in GetStuff method and use Attach to Process

    Visual Studio > Tools > Attach To Process and see if breakpoints below that line gets hit.

    0 讨论(0)
提交回复
热议问题