Welcome to MSDN Blogs Sign in | Join | Help

Creating a simple Addin for PDC Whidbey. SlimeTrail for the the debugger.

 

(I've updated this post: http://blogs.msdn.com/stevejs/archive/2005/12/21/506477.aspx )

 

This is the first time I've created an Addin for VS.  This one was built using the PDC build of Visual Studio Whidbey.  The idea behind this was to make the simplest useful Addin I could.  If you have any suggestions on what I else I could have left out let me know. :-)

 

Step by Step

1. Open VS. Go to File/New/Project. -> Dialog appears.

2. Go to Other Projects -> Extensibility Projects -> Visual Studio .Net Add-in

3. Change the name of the project from MyAddin1 to SlimeTrailAddin, click OK.

4. In the wizard chose C# and next all the way until it says finish.

 

You will now have a source file open called Connect.cs

 

5. Find the OnConnection method.  It will have two lines of code in it.

6. Add the following to the end of the method:

applicationObject.StatusBar.Text = "SlimeTrail Addin loaded";

applicationObject.Events.DebuggerEvents.OnEnterBreakMode += new _dispDebuggerEvents_OnEnterBreakModeEventHandler(DebuggerEvents_OnEnterBreakMode);

 

7. Add this member variable to the Connect class:

private System.Collections.Generic.Queue<EditPoint> editPointQueue = new System.Collections.Generic.Queue<EditPoint>();

 

8. Add the following method:

private void DebuggerEvents_OnEnterBreakMode(dbgEventReason Reason, ref dbgExecutionAction ExecutionAction)

{

      TextDocument textDocument = (TextDocument) applicationObject.ActiveDocument.Object("TextDocument");

      textDocument.Selection.SetBookmark();

      editPointQueue.Enqueue(textDocument.Selection.ActivePoint.CreateEditPoint());

      if (editPointQueue.Count > 5)

      {

            editPointQueue.Dequeue().ClearBookmark();

      }

}

9. Compile

 

10. To use it. Open VS. Tools/Add-in Manager.

11. Check the box next to SlimeTrailAddin. Hit Ok.

You should see "SlimeTrail Addin loaded" appear in the status bar.

 

When you debug you should get a trail of 5 bookmarks showing the last lines you stopped at.

 

If you find any issues with this please let me know in the comments.

Published Thursday, January 22, 2004 7:23 PM by SteveJS

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Creating a simple Addin for PDC Whidbey. SlimeTrail for the the debugger.

While I am sure it not your fault, I have to ask this of someone: Why is the documentation for writing a VS.Net add-in so horrible? I mean, at least compared to the documentation for, say, the .NET core framework. Many of the objects will have one line of documentation, and quite frankly I have become spoiled by page long descriptions of exactly what an object is, how to use it, etc.
Thursday, January 29, 2004 9:27 AM by Eric Wilson

# re: Creating a simple Addin for PDC Whidbey. SlimeTrail for the the debugger.

I sadly must agree on your assessment of the docs for VS Addins, at least what I've seen for Whidbey so far. I started answering this with my guess on the reason. However, I'll hold back on that and instead ask around and get a real answer.

Thursday, January 29, 2004 9:40 AM by SteveJS

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker