Thursday, March 5, 2009

C# debugging

If you are a C# developer using Visual Studio 2008 and you need to debug your solution using arguments? Then read on.

There is a nice security feature in VS2008 that prevents arguments from being passed on to your executable. There even is a nice warning message, that tells you something about some bogus debug security settings. I haven't found any of these settings anywhere in the project, solution or even VS2008 settings.

I've still found a workaround, however:
  1. In your C# project settings under Debug activate SQL-Server debugging
  2. Make sure you've entered some arguments in the run options
  3. Debug your solution
  4. Profit!
You'll see the familiar messagebox telling you that the security settings permit the arguments from being passed on to the executable. Continue anyway. Then you'll see a second messagebox, yapping on about some debug security settings that were disabled. Well guess what - from now on you can use arguments to debug! Oh and of course you can disable SQL server debugging, it's only needed to trigger that metaphysical process in VS2008. ;)

No comments: