Results 1 to 3 of 3

Thread: figure out if app is running in debug mode?

  1. #1

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428

    figure out if app is running in debug mode?

    is ther a way to do that with code? I wanna know if my app is running in debug mode or release mode
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  2. #2
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Hi Mr. Polite.

    After a (big) bit of tinkering, I finally came up with this.

    VB Code:
    1. Dim a As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly
    2.  
    3.         Dim o() As Object = a.GetCustomAttributes(GetType(System.Diagnostics.DebuggableAttribute), True)
    4.         If o.Length > 0 Then
    5.             MsgBox("Debug Mode")
    6.         Else
    7.             MsgBox("Release Mode")
    8.         End If

    Strange thing is, that when searching in the help, they claim that there is a DefineDebug property, but that's nowhere to be found.

    The FileVersionInfo has a IsDebug property, which apparently always returns false, so that's not much use either.

    But as far as I can tell, the above solution appears solid.

    Enjoy.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

  3. #3

    Thread Starter
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by pax
    Hi Mr. Polite.

    After a (big) bit of tinkering, I finally came up with this.

    VB Code:
    1. Dim a As Reflection.Assembly = Reflection.Assembly.GetExecutingAssembly
    2.  
    3.         Dim o() As Object = a.GetCustomAttributes(GetType(System.Diagnostics.DebuggableAttribute), True)
    4.         If o.Length > 0 Then
    5.             MsgBox("Debug Mode")
    6.         Else
    7.             MsgBox("Release Mode")
    8.         End If

    Strange thing is, that when searching in the help, they claim that there is a DefineDebug property, but that's nowhere to be found.

    The FileVersionInfo has a IsDebug property, which apparently always returns false, so that's not much use either.

    But as far as I can tell, the above solution appears solid.

    Enjoy.
    haha thank you sorry for the trouble
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width