Kanini
Kanini

Reputation: 1993

Unable to set breakpoints in VS 2010

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();
        }
    }
}

Upvotes: 0

Views: 1554

Answers (2)

Romil Kumar Jain
Romil Kumar Jain

Reputation: 20745

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.

Upvotes: 1

Romil Kumar Jain
Romil Kumar Jain

Reputation: 20745

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.

Upvotes: 0

Related Questions