VB.NET - isdebug always returns false 
Author Message
 VB.NET - isdebug always returns false

Hi

When I read the isdebug property from fileversioninfo it always show false
despite using a debug build.

Does anyone know why this might be?

--
Nick Cooper
IT Systems Officer
University of Bath - School of Management



Mon, 21 Feb 2005 18:26:29 GMT  
 VB.NET - isdebug always returns false
Nick,

Quote:
>Does anyone know why this might be?

I guess the compiler doesn't set it as expected.

If you want to detect release/debug build, look for the
System.Diagnostics.DebuggableAttribute on the assembly.

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Mon, 21 Feb 2005 19:07:56 GMT  
 VB.NET - isdebug always returns false
Mattias,

Thanks for the response.

I've had a look at System.Diagnostics.DebuggableAttribute but I'm not sure
how I should query it.

Would you post a code snippet?

TIA

--
Nick Cooper
IT Systems Officer
University of Bath - School of Management


Quote:
> Nick,

> >Does anyone know why this might be?

> I guess the compiler doesn't set it as expected.

> If you want to detect release/debug build, look for the
> System.Diagnostics.DebuggableAttribute on the assembly.

> Mattias

> ===

> http://www.msjogren.net/dotnet/
> Please reply only to the newsgroup.



Tue, 22 Feb 2005 17:18:52 GMT  
 VB.NET - isdebug always returns false
Nick,

Quote:
>I've had a look at System.Diagnostics.DebuggableAttribute but I'm not sure
>how I should query it.

>Would you post a code snippet?

Imports System.Reflection
Imports System.Diagnostics

...

Function IsDebug(ByVal asm as [Assembly]) As Boolean
  Dim attr() as Object = asm.GetCustomAttributes( _
    GetType(DebuggableAttribute), False)
  If attr.Length <> 1 Then Return False
  Return DirectCast(attr(0), DebuggableAttribute).IsJITTrackingEnabled
End Function

...

Console.WriteLine(IsDebug(GetType(MyMainClass).Assembly))

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Tue, 22 Feb 2005 19:35:34 GMT  
 VB.NET - isdebug always returns false
Mattias,

Thanks very much for that. I am grateful.

--
Nick Cooper
IT Systems Officer
University of Bath - School of Management


Quote:
> Nick,

> >I've had a look at System.Diagnostics.DebuggableAttribute but I'm not
sure
> >how I should query it.

> >Would you post a code snippet?

> Imports System.Reflection
> Imports System.Diagnostics

> ...

> Function IsDebug(ByVal asm as [Assembly]) As Boolean
>   Dim attr() as Object = asm.GetCustomAttributes( _
>     GetType(DebuggableAttribute), False)
>   If attr.Length <> 1 Then Return False
>   Return DirectCast(attr(0), DebuggableAttribute).IsJITTrackingEnabled
> End Function

> ...

> Console.WriteLine(IsDebug(GetType(MyMainClass).Assembly))

> Mattias

> ===

> http://www.msjogren.net/dotnet/
> Please reply only to the newsgroup.



Tue, 22 Feb 2005 20:35:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. eof() always returning false - Beta 2

2. InternetGetConnectedState always returns false...

3. MAPImessages msgSent Property always returns FALSE

4. PtInRect always returns false...

5. IsSecurityEnabled always returns false

6. issecurityenabled always return false

7. FSO FileExists always returns false

8. Ds.Updatable is always false

9. Dynaset.Ipdatable is always false

10. App.PrevInstance is always false???

11. window.close always eq FALSE

12. MaskedEdit (SP3) - BUG: If not Bound, then .DATACHANGED always False

 

 
Powered by phpBB® Forum Software