AppDomain.FriendlyName and Vshost

In this post, Dave Templin explains the purpose of the .vshost.exe that gets created automatically by Visual Studio Whidbey. What it also mentions is the fact that the application domain my code runs in is of course different when I run in the debugger. I found a problem with this where the FriendlyName is concerned. I’ve been using the FriendlyName to construct names based on my application’s exe name, the same way the normal app.config files work. The problem is, as soon as I run the app in the debugger, the FriendlyName is no longer the same and the config file that’s already there isn’t found.

To solve this, I was looking for a way to find out the “real” base name of my application’s exe file, without the vshost. part. Apparently, there’s no special property or anything that would let me access this information directly… maybe that would be a useful extension to the System.Diagnostics.Debugger class.

The solution was simple for the moment: I used a regular expression to do a simple replacement on the string:

string myName = Regex.Replace(

Of course that’s not a perfect solution, but as it’s only relevant for a developer who may run the program in the debugger, it should be alright for now. Maybe they’ll expose some more information about this to the running app in the future so it can behave a bit more intelligently… or I’m missing something 😃

Sorry, this blog does not support comments.

I used various blog hosting services since this blog was established in 2005, but unfortunately they turned out to be unreliable in the long term and comment threads were lost in unavoidable transitions. At this time I don't want to enable third-party services for comments since it has become obvious in recent years that these providers invariably monetize information about their visitors and users.

Please use the links in the page footer to get in touch with me. I'm available for conversations on Keybase, Matrix, Mastodon or Twitter, as well as via email.