Author Topic: Debugging Attribute  (Read 2476 times)

0 Members and 1 Guest are viewing this topic.

Glenn R

  • Guest
Debugging Attribute
« on: August 01, 2008, 12:10:53 PM »
May make your debugging life easier.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Debugging Attribute
« Reply #1 on: August 01, 2008, 04:02:24 PM »
Thanks
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Debugging Attribute
« Reply #2 on: August 01, 2008, 08:56:24 PM »
Yes, thanks Glenn. Nice little find.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Debugging Attribute
« Reply #3 on: August 01, 2008, 09:51:56 PM »

great link Glenn
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Glenn R

  • Guest
Re: Debugging Attribute
« Reply #4 on: August 02, 2008, 04:53:57 AM »
Taken from the news channel when you start Visual Studio 2008 BTW...first link yesterday. It's very interesting what you can find on it actually.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8706
  • AKA Daniel
Re: Debugging Attribute
« Reply #5 on: August 02, 2008, 09:37:56 AM »
Great find Glenn,

Another useful attribute is ;
Code: [Select]
[System.Diagnostics.Conditional()]
example;

Code: [Select]
    [System.Diagnostics.Conditional("DEBUG")]
    internal static void DEBUG_PRINT_VAL(object o)
    {
      DEBUG_PRINT_VAL(string.Empty, o);
    }
    [System.Diagnostics.Conditional("DEBUG")]
    internal static void DEBUG_PRINT_VAL(string varname , object o)
    {
      AcAp.Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage(varname + o.ToString());
    }

    [CommandMethod("test")]
    public static void test()
    {
      Point3d A = Point3d.Origin;

      //if DEBUG is not defined, the compiler will remove this call
      DEBUG_PRINT_VAL(A);
    }
« Last Edit: August 02, 2008, 09:40:58 AM by Daniel »