0

I'm checking if a debugger is present in my c++ dll with method

if(IsDebuggerPresent()) // set dll name to debug

When I load this dll in my C++/CLI wrapper (debug mode in VS) the method always returns false (release) -> why is it so? (or which code I need to determine this information)

Thank you for your help!

greets leon22

leon22
  • 5,280
  • 19
  • 62
  • 100
  • 1
    Is unmanaged debugging option selected in debugger? – Alex F Jul 05 '11 at 14:25
  • 1
    Wait, are you saying "it is false in debug build" (i.e. wrapper is built as "debug") or "it is false when _run from_ the debugger"? Those are different things. – Damon Jul 05 '11 at 14:26
  • That was the solution: just enable unmanaged debugging ! (http://msdn.microsoft.com/en-us/library/tdw0c6sf.aspx) – leon22 Jul 05 '11 at 15:17

2 Answers2

0

System.Diagnostics.Debugger.IsAttached returns true if a debugger is attached to your application. Is this what you are trying to achieve?

larsmoa
  • 12,604
  • 8
  • 62
  • 85
  • I know this method, but this is only for managed .net code -> I'm into an native C++ dll (loaded from .net C++/CLI wrapper)! – leon22 Jul 05 '11 at 15:04
0

That was the solution: just enable unmanaged debugging ! (msdn.microsoft.com/en-us/library/tdw0c6sf.aspx)

leon22
  • 5,280
  • 19
  • 62
  • 100