Results 1 to 7 of 7

Thread: [RESOLVED] [NOT - RESOLVED] View images in the debugger

  1. #1

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Resolved [RESOLVED] [NOT - RESOLVED] View images in the debugger

    Hey all,

    Does anyone know if there is a way to view images directly from the debugger in VS2013 while stopped at a break point? I am looking for something that would be analogous to the DataSet Visualizer for viewing a data table except for an image. If not could this be created as an add on?

    Thanks kevin
    Last edited by kebo; Oct 2nd, 2017 at 09:56 AM.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  2. #2
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,190

  3. #3
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: View images in the debugger

    Besides topshot's recommendations, it's not hard to code your own DebuggerVisualizer for images. This has the advantage that you can customize it however you like. Here's a VB.Net version based on the CodeProject article by Tomer Noy. It dates from VS2005 but it works fine in VS2013 and I'm sure it still will in VS2015/7.

    To make and install it:
    1. Start a ClassLibary project.
    2. Add the following project references:
    Code:
    Microsoft.VisualStudio.DebuggerVisualizers
    System.Drawing
    System.Windows.Forms
    3. Code a Class as follows:
    vb.net Code:
    1. Imports Microsoft.VisualStudio.DebuggerVisualizers
    2. Imports System.Windows.Forms
    3. Imports System.Drawing
    4.  
    5. <Assembly: System.Diagnostics.DebuggerVisualizer(GetType(ImageVisualizer.DebuggerSide), GetType(VisualizerObjectSource), Target:=GetType(System.Drawing.Image), Description:="Image Visualizer")>
    6. Namespace ImageVisualizer
    7.    Public Class DebuggerSide
    8.       Inherits DialogDebuggerVisualizer
    9.       Protected Overrides Sub Show(windowService As IDialogVisualizerService, objectProvider As IVisualizerObjectProvider)
    10.          Dim image As Image = DirectCast(objectProvider.GetObject(), Image)
    11.          Dim form As New Form With {.Text = image.Size.ToString, .AutoSize = True, .FormBorderStyle = FormBorderStyle.FixedToolWindow}
    12.          Dim pictureBox As New PictureBox With {.Image = image, .Parent = form, .Dock = DockStyle.Fill}
    13.          windowService.ShowDialog(form)
    14.       End Sub
    15.    End Class
    16. End Namespace

    4. Build the solution.

    5. In File Explorer, find the compiled ImageVisualizer.dll in the project's bin\Debug folder and copy it into the installed Visual Studio Common7/Packages/Debugger/Visualizers folder.

    Restart Visual Studio and, hey presto, you have a debugger visualizer for images!

    BB

  4. #4

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: View images in the debugger

    hey presto, you have a debugger visualizer for images!
    Now that what I'm talking about. I should have made this post years ago. Thanks a ton BB.

    BTW, the dll can also be put in the My Documents\ VisualStudioVersion \Visualizers folder as well.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  5. #5

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: [RESOLVED] View images in the debugger

    I've rolled up to VS2017, and my visualizer broke with the following message,
    Name:  Capture.JPG
Views: 186
Size:  29.2 KB.
    It was working, and still does work in VS2013.

    I've tried rebuilding the visualizer in VS2017, but to no avail. This is the code, which as you can see inherits from DialogDebuggerVisualizer.

    vb.net Code:
    1. Imports Microsoft.VisualStudio.DebuggerVisualizers ' < -- import the namespace
    2. Imports System.Windows.Forms
    3. Imports System.Drawing
    4.  
    5. <Assembly: System.Diagnostics.DebuggerVisualizer(GetType(ImageVisualizer.DebuggerSide), GetType(VisualizerObjectSource), Target:=GetType(System.Drawing.Image), Description:="Image Visualizer")>
    6. Namespace ImageVisualizer
    7.     Public Class DebuggerSide
    8.         Inherits DialogDebuggerVisualizer ' < - inherit the Visualizer
    9.         Protected Overrides Sub Show(windowService As IDialogVisualizerService, objectProvider As IVisualizerObjectProvider)
    10.             Dim image As Image = DirectCast(objectProvider.GetObject(), Image)
    11.             Dim form As New Form With {.Text = image.Size.ToString, .AutoSize = True}
    12.             Dim pictureBox As New PictureBox With {.BackgroundImage = image, .Parent = form, .BackgroundImageLayout = ImageLayout.Zoom, .Dock = DockStyle.Fill}
    13.  
    14.             Try
    15.                 windowService.ShowDialog(form)
    16.             Catch ex As Exception
    17.                 MessageBox.Show(String.Format("{0}{1}{1}{2}", ex.Message, Environment.NewLine, ex.ToString))
    18.             End Try
    19.  
    20.         End Sub
    21.     End Class
    22. End Namespace
    Not sure whats going on here.Has anyone seen this with their visualizers, or is there something special I need to do for VS2017
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  6. #6
    PowerPoster boops boops's Avatar
    Join Date
    Nov 2008
    Location
    Holland/France
    Posts
    3,201

    Re: [RESOLVED] View images in the debugger

    That's strange because the class clearly does inherit from the correctly named class. I don't have VS2017 installed to try it out, but I wonder if you are referencing an outdated version of Microsoft.VisualStudio.DebuggerVisualizer? I notice that there's a version 12 as well as a version 10.

    BB

  7. #7

    Thread Starter
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,762

    Re: [NOT - RESOLVED] View images in the debugger

    Well you were certainly on the right track. To get it to work in VS2017, I had to build the visualizer in VS2017 with DebuggerVisualizer version 15.

    Thanks for the input. My world is right once again.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

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