开发者

Identify debugging in VisualStudio

开发者 https://www.devze.com 2023-03-28 12:42 出处:网络
I have an interesting problem. Is it possible to identify if an assembly is running in Visual Studio? Look at the following code.

I have an interesting problem.

Is it possible to identify if an assembly is running in Visual Studio?

Look at the following code.

if(FoundThatYouAreDebuggingInVisualStudio)
{
    Print "Hello"
} 
else 
{
    Print "Hi"
}
开发者_StackOverflow社区

The above code is present in a .NET assembly (say XYZ) which is built in Release mode. The user is debugging his/her application (say ABC) that references to XYZ assembly.

I need to identify if the user is debugging in the Visual Studio or he is just running the ABC application.

Any ideas?

-D


Perhaps you're looking for System.Diagnostics.Debugger.IsAttached

0

精彩评论

暂无评论...
验证码 换一张
取 消