In C#/VB
in Visual Studio 2010
, is there way in the code to determine whether the program is currently running in the IDE or not?
eg. If ProgramRunningInIDE Then MessageBox.Show exc.Message
In C#/VB
in Visual Studio 2010
, is there way in the code to determine whether the program is currently running in the IDE or not?
eg. If ProgramRunningInIDE Then MessageBox.Show exc.Message
You could check if the debugger is attached with:
System.Diagnostics.Debugger.IsAttached
This essentially does the same thing.
There is an IsInDesignMode property you can use. In some circumstances it isn't accurate, though, so you additionally may want to check the UsageMode.
public static bool IsRunningInIdeContext
{
get {
if (DesignerProperties.IsInDesignMode)
return true;
return LicenseManager.UsageMode == LicenseUsageMode.Designtime;
}
}
© 2022 - 2024 — McMap. All rights reserved.
#if DEBUG
. – Unobtrusive