Summary of Answers
To avoid the debugger trapping Ctrl+C first turn off the Visual Studio Hosting Process (found in project pro
There seems to be a bug in VS 2010 debugger / .NET 4 that you get a strange 'no symbols' window when Ctrl+C is pressed in a console application with only managed debugging. There is a work-around to enable mix-mode debugging. The bug says 'fixed', but if other folks are hitting this please report it on the connect bug so the fix gets into a hotfix / SP.
I saw this while debugging a service that uses TopShelf library to host a windows service which also lets you debug the service locally as a console application.
https://connect.microsoft.com/VisualStudio/feedback/details/524889/debugging-c-console-application-that-handles-console-cancelkeypress-is-broken-in-net-4-0?wa=wsignin1.0
Related Links: TopShelf, (came from MassTransit)
Update: It seems the connect bug is for VS 2010 Beta, but I'm seeing the strange 'no source available' in managed-only debugging with VS 2010 RTM with what I believe to be the latest hotfixes.
CTRL-C is wired directly to the console window itself for the 'break' operation. Open a new console app, ping something, then immediately press CTRL-C. It aborts the ping.
You said VS Pro didn't have this behavior. I'm assuming it was just itself setting SetConsoleMode whereas VS Express doesn't. However, you can still tell the console directly to ignore CTRL-C and treat it as straight input yourself with SetConsoleMode. See this link for details:
Here's an example usage in C#:
Just put the call with your chosen mode options at the beginning of your program and you should be good to go!
Hope this helps!
M
I found the answer, it is a debugging Exception option. I don't know how I missed it the first time, but here it is:
Debug -> Exceptions... Win32 Exceptions - Control-C
This is in VS2008 Pro.
I can also confirm that the option does NOT exist in the Express editions (the entire Win32 Exceptions node is missing).
So the only question I have left, since I don't own VS2010 Pro (yet?) is: Does the Win32 Exceptions node, and the Control-C exception exist in the VS2010 Pro edition?
TopShelf has reported this problem:
https://github.com/Topshelf/Topshelf/issues/10
And Microsoft has acknowledged it:
https://connect.microsoft.com/VisualStudio/feedback/details/524889/debugging-c-console-application-that-handles-console-cancelkeypress-is-broken-in-net-4-0
Perhaps this is common knowledge by now but we were having the same problem when trying to stop a topshelf application using ctrl-c while being debugged in visual studio. In the end we figured that you need to turn off capturing control-c win32 exceptions when thrown (Debug->Exceptions, or ctrl d,e open Win32 Exceptions then uncheck control-c in the thrown column) and then also go to the project (that is running the service) properties and on the debug tab check the option enable unmanaged code debugging. We are using MS Visual Studio 2010 pro version 10.0.40219.1 SP1Rel.