0

I launch VS 2010. Click on create new project. Type the following code in. Hit f5. Runs fine. But when I try and set a break point either by F9 or by right click on a line of code and chose Breakpoint -> Insert Breakpoint, nothing happens.

The project properties are set to Debug.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SetBreakPoints
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 7;
            int b = 5;
            a = a - b;
            b = b + a;
            a = b - a;
            Console.WriteLine("Value of a is {0} and value of b is {1}", a, b);
            Console.ReadKey();
        }
    }
}
8
  • Check the target framework for this project, if it's not 4.0 then we will need some configuration settings in app.config. Commented May 11, 2012 at 10:03
  • Target framework was .NET 4 Client Profile. Now, it is changed to .NET Framework 4.0 and still, unable to debug.
    – Kanini
    Commented May 11, 2012 at 10:15
  • Did you create a new project in VS 2010 or opened an existing project. One more thing you can try, first rebuild the solution and then debug. Commented May 11, 2012 at 10:23
  • @Romil Yes, it is a new project and the only project in the solution in VS 2010. Did a rebuild, it was successful. Tried to debug and did not work.
    – Kanini
    Commented May 11, 2012 at 10:32
  • Please reset your VS 2010 settings as I mentioned in my new post and then choose "General Development Settings" after reopening VS 2010. Commented May 11, 2012 at 10:37

2 Answers 2

1

Please reset VS 2010 settings.

To reset your VS 2010 settings, perform following steps:

On the Tools menu, click Import and Export Settings.

On the Welcome to the Import and Export Settings Wizard page, click Reset all settings and then click Next.

If you want to save your current settings combination, click Yes, save my current settings, specify a file name, and then click Next.

—or—

If you want to delete your current settings combination, choose No, just reset settings, overwriting my current settings, and then click Next. This option does not delete default settings, which will still be available the next time you use the wizard.

In Which collection of settings do you want to reset to, select a settings collection from the list.

Click Finish.

The Reset Complete page alerts you to any problems encountered during the reset.

Now close VS 2010 and reopen the solution and select "General Development settings" in the box.

3
  • Romil: Thanks for the detailed answer. I tried all of the settings, but even then it does not work.
    – Kanini
    Commented May 11, 2012 at 10:39
  • Kanini, were you able to debug any of the project in VS 2010 previously. or you have just installed the VS 2010 and start working. Commented May 11, 2012 at 10:42
  • Romil: I have been working on various projects for a year long, with VS2010. I have used various tools, such as Resharper along with VS2010. I recently did update it though, but I have uninstalled it.
    – Kanini
    Commented May 11, 2012 at 12:23
0

It seems that you have opened an existing project in VS 2010 that was created in earlier version of visual studio 2005/2008.

There is a known issue where you won't hit breakpoints if your add-in is built against a version of the .Net framework before 4.0. For me, changing to 4.0 fixed this problem.

How to fix the issue

Another thing to try is running devenv from the command line with the parameter /log vslog.xml then exit. Check the file <ApplicationData>\Roaming\Microsoft\VisualStudio\<version>\vslog.xml. This might tell you that there's some other problem loading your add-in which means the dll isn't getting loaded.

1
  • Did exactly as you mentioned, but No log was created at the mentioned path. Am I missing something?
    – Kanini
    Commented May 11, 2012 at 10:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.