C# – VS2015 Error while trying to run project

cnetvisual studiovisual-studio-2015winforms

I am using VS2015 Update 1
I just start a new application with nothing special, no db, no COM references. Just a simple winform application.

I am getting the following error:

Error while trying to run project: Unable to start debugging.

The object invoked has disconnected from its clients.

My Code:

public partial class RegistratorForm : Form
{
    public RegistratorForm()
    {
        InitializeComponent();
    }

    private void RegistratorFileBrowseButton_Click(object sender, EventArgs e)
    {
        using (var openDialog = new OpenFileDialog())
        {
            openDialog.Title = "Open Text File";
            openDialog.Filter = "Registrator files|*.rgr";
            openDialog.InitialDirectory = ConfigurationManager.AppSettings["DefaultRegistratorFilePath"];
            if (openDialog.ShowDialog() == DialogResult.OK)
            {

            }
        }
    }
}

My Form:

enter image description here

My app.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
   <appSettings>
     <add key="DefaultRegistratorFilePath" value="C:\"/>
   </appSettings>
</configuration>

Best Answer

Try to restart Visual Studio. That should do the trick. If not, then you should do as suggested here

  1. Check which files were changed (why and how) after update from a source control engine
  2. Review the list of extensions and plugins. Try to disable all or some of them
  3. Close Visual Studio and kill all the development processes: devenv, mspdbsrv, vcpkgsrv, msbuild, conhost, msvsmon etc
  4. Remove .suo and .ncb files of the solution, which sometimes cause problems
  5. Remove project setting files, sort of YourProjectName.vcproj.DOMAINNAME.LOGINNAME.user or YourProjectName.csproj.user.
  6. The setting file name depends on a project kind you use Run "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup or "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe" /setup for x64 environment