Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. Visual Studio - ordering of objects in debugger

Visual Studio - ordering of objects in debugger

Scheduled Pinned Locked Moved The Lounge
csharpvisual-studiodebuggingquestion
14 Posts 7 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Michael Breeden

    I have a number of objects in some apps with numerous variables and objects in them. When in the debugger, I'm usually only interested in a few values (bIsThisIncluded being the one I wish I could see). Unfortunately, when I mouse over to see what their values are I usually have to scroll down to see the value I want to know about. Is there any way to make them appear at the top of the list? It's not alphabetic. I've moved them around in my class declaration. I just wish I could get a few to appear at the top. Any ideas? Thanks, Mike

    S Offline
    S Offline
    Slacker007
    wrote on last edited by
    #5

    Same as what Guy said or you can also use Quick Watch and it is easier to navigate to what you want to see there. Just right click on a variable name and select Quick Watch while in debug break-point mode. I use this a lot.

    1 Reply Last reply
    0
    • H honey the codewitch

      Yes, but it's not straightforward and depends on what environment you're using. Under .NET you can create something called a DebuggerTypeProxy that returns a filtered or sorted list of items Here's a snippet of one I wrote for a project here that's still pending approval. meh

      #if DEBUG
      [DebuggerTypeProxy(typeof(DebugProxy))]
      #endif // DEBUG
      public sealed partial class Struple : DynamicObject, IDictionary<string,object>
      {
      #region debug proxy
      #if DEBUG
      sealed class DebugProxy
      {
      IDictionary<string,object> _outer;
      internal DebugProxy(IDictionary<string,object> outer)
      {
      _outer = outer;
      }
      [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)]
      public KeyValuePair<string,object>[] Items {
      get {
      var result = new KeyValuePair<string,object>[_outer.Count];
      _outer.CopyTo(result, 0);
      return result;
      }
      }
      }
      #endif // DEBUG
      #endregion debug proxy

      When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

      S Offline
      S Offline
      Slacker007
      wrote on last edited by
      #6

      Sorry, but that is just f'n scary to me. People making things way too complicated. I think. :laugh:

      H R 2 Replies Last reply
      0
      • S Slacker007

        Sorry, but that is just f'n scary to me. People making things way too complicated. I think. :laugh:

        H Offline
        H Offline
        honey the codewitch
        wrote on last edited by
        #7

        interacting with the debugger is scary the #defines aren't necessary, just FYI I prefer not dragging around an extra class in release builds is all

        When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

        S 1 Reply Last reply
        0
        • H honey the codewitch

          interacting with the debugger is scary the #defines aren't necessary, just FYI I prefer not dragging around an extra class in release builds is all

          When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

          S Offline
          S Offline
          Slacker007
          wrote on last edited by
          #8

          codewitch honey crisis wrote:

          interacting with the debugger is scary

          Ok. I guess. I work in the debugger every day at various levels of complexity and I have never in my career needed to do extra code to get things done like that. I guess your situation calls for it. so be it. :thumbsup: debugger has never been scary for me. knock on wood. :laugh:

          H 1 Reply Last reply
          0
          • S Slacker007

            codewitch honey crisis wrote:

            interacting with the debugger is scary

            Ok. I guess. I work in the debugger every day at various levels of complexity and I have never in my career needed to do extra code to get things done like that. I guess your situation calls for it. so be it. :thumbsup: debugger has never been scary for me. knock on wood. :laugh:

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #9

            I just mean the visual studio live debugger integration. it has never been particularly friendly. using the debugger is friendly, and so are certain operations like Debug.WriteLine and Debugger.IsAttached, but to create "views" for objects beyond really simple things can often require custom code. It's just that most people never really need to do it. The question in the OP is one that just doesn't come up that often in the real world. As those often can be, the solution is arcane. It's one of those dark corners of the debugger most people never need to touch. How many people need to filter items in a collection or dictionary at debug time only? Fortunately it's not a lot of code. The meat of it is in a single short method.

            When I was growin' up, I was the smartest kid I knew. Maybe that was just because I didn't know that many kids. All I know is now I feel the opposite.

            1 Reply Last reply
            0
            • S Slacker007

              Sorry, but that is just f'n scary to me. People making things way too complicated. I think. :laugh:

              R Offline
              R Offline
              Rick York
              wrote on last edited by
              #10

              If you want scary - try writing your own debugger. I did. I'm nearly bald now and I think there is a correlation.

              "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

              S 1 Reply Last reply
              0
              • R Rick York

                If you want scary - try writing your own debugger. I did. I'm nearly bald now and I think there is a correlation.

                "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                S Offline
                S Offline
                Slacker007
                wrote on last edited by
                #11

                My hat's off to you guys who do compilers, debuggers, kernel work (munchies matt i think does this), anything lower level stuff, etc. No thank you. I have a few hairs left on my head and would like to keep them if possible. :laugh:

                R 1 Reply Last reply
                0
                • S Slacker007

                  My hat's off to you guys who do compilers, debuggers, kernel work (munchies matt i think does this), anything lower level stuff, etc. No thank you. I have a few hairs left on my head and would like to keep them if possible. :laugh:

                  R Offline
                  R Offline
                  Rick York
                  wrote on last edited by
                  #12

                  The debugger I wrote was a companion to the script language compiler I also wrote. It wasn't just merely a script language though - it compiled to native machine code and it was pretty fast. Writing those was some of the most fun I have ever had programming. It was also very tricky, hence the lack of hair. Sometimes, when I am feeling particularly masochistic, I think about what I would do differently. Then I remind myself that it's not my problem any more.

                  "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                  1 Reply Last reply
                  0
                  • M Michael Breeden

                    I have a number of objects in some apps with numerous variables and objects in them. When in the debugger, I'm usually only interested in a few values (bIsThisIncluded being the one I wish I could see). Unfortunately, when I mouse over to see what their values are I usually have to scroll down to see the value I want to know about. Is there any way to make them appear at the top of the list? It's not alphabetic. I've moved them around in my class declaration. I just wish I could get a few to appear at the top. Any ideas? Thanks, Mike

                    S Offline
                    S Offline
                    stoneyowl2
                    wrote on last edited by
                    #13

                    I use Oz Code debugger extension - I love all the things it does. It even predicts future events that can cause bad things to happen and warns you before your debugging pointer gets there....

                    A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                    S 1 Reply Last reply
                    0
                    • S stoneyowl2

                      I use Oz Code debugger extension - I love all the things it does. It even predicts future events that can cause bad things to happen and warns you before your debugging pointer gets there....

                      A human being should be able to change a diaper, plan an invasion, butcher a hog, navigate a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects! - Lazarus Long

                      S Offline
                      S Offline
                      Slacker007
                      wrote on last edited by
                      #14

                      stoneyowl2 wrote:

                      It even predicts future events

                      Sold!

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups