Running Visual Studio 2008 .net 2.0.
From the Debug Menu, I select Exceptions and set it up to break when CLR Exceptions are thrown.
Then I do file new project, select a new console application.
I add the following 2 lines inside of main.
Console.WriteLine(System.Windows.Forms.Application.ExecutablePath);
Console.ReadKey();
When I execute this code I get a FileNotFOundException saying it can’t find \ConsoleApplication1\ConsoleApplication1\bin\Debug\ConsoleApplication1.vshost.exe.config.
I’m wondering both why this happens and how to prevent it from happening as I would like to leave the break on thrown CLR Exceptions setting on during any testing sessions.
Thanks.
EDIT: I’m aware of the VSHosting system and am ok with the existence of the files and what they are for. I don’t want to turn of hosting. I’m just not sure why a call to Application.ExecutablePath is looking for the config file. I was able to get around it in one spot by changing it to a system.reflection call to get the same value. But then I got the same error in on a “new DevExpress.XtraEditors.ButtonEdit()” call.
The issue was that I didn’t not have an app.config defined in my project and I had the JustMyCode debugging option disabled. So soemthing instead of that call is throwing an exception for the missing app.config and since it was set to throw on exception and not JustMyCode the Visual Studio debugger was catching it and breaking at that point.