Visual TorqueScript #3.5

Small update: After hours and hours of error and trial (and implementing a few interfaces by using Copy&Paste wisely), I've finally managed to get Visual Studio to load my debug engine.

This looks gorgeous, doesn't it?

A few notes for those interested in writing Debug Engines:

  • See my previous post for the ProvideDebugEngine helper attribute
  • There exists a really nice managed debug engine example, that isn't part of the SDK.
    You can find it here.
  • You are required to set a PortSupplier, even if the documentation says otherwise (this was a major source of frustration in the last hour).
  • Since ProvideDebugEngine requires a Type for PortSupplier, I've been using this stub class:
        /// <summary>
        /// The class is just a stub for use with ProvideDebugEngine.
        /// It seems it's mandatory to provide a PortSupplier GUID with a debug engine.
        /// </summary>
        [Guid("708C1ECA-FF48-11D2-904F-00C04FA302A1")]
        internal sealed class DefaultPortSupplier
        {
        }
    
  • I've also added another attribute (ProvideClass) for convenience to register a class directly (it's the same as using ProvideObject on the current class type).
    Since the code is quite short, I'm going to supply it directly:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace Microsoft.VisualStudio.Shell
    {
        /// <summary>
        /// This is just a wrapper for ProvideObject to provide the class the attribute is used on
        /// </summary>
        [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
        class ProvideClass : RegistrationAttribute
        {
            public override void Register(RegistrationAttribute.RegistrationContext context)
            {
                ProvideObjectAttribute objectProvider = new ProvideObjectAttribute(context.ComponentType);
                objectProvider.Register(context);
            }
    
            public override void Unregister(RegistrationAttribute.RegistrationContext context)
            {
                ProvideObjectAttribute objectProvider = new ProvideObjectAttribute(context.ComponentType);
                objectProvider.Unregister(context);
            }
        }
    }
    

And yes, I love the tag :-)
Cheers,
Andreas

  1. I'm struggling with the same thing right now! I felt like I was running down the rabbit hole. Thanks for the tips. I'm still struggling getting my debug engine into VS. I don't see the reg keys getting set when I use the ProvideDebugEngine attribute. Anything special I have to do besides follow the guidelines you posted in your posts about your custom DE experiences?

  2. Hello Adam,
    I'm not sure myself. I haven't worked on this project in ages, and last time I tried to get it running again, I had some issues myself.

    Nonetheless I've uploaded the debug attributes I've written in the version that used to work for me here:
    http://blog.blackhc.net/wp-content/uploads/2008/09/DebuggerAttributes.zip
    There might be some changes compared to the versions here on the blog, which might matter.
    Hope it helps.
    Cheers,
    Andreas

  3. I'm also struggling to get my DE registering with VS.

    I understand it's been a long time since you looked at this and you've got other things to work on. There just isn't very good documentation in my opinion on MS's side for writing one of these.

    I don't suppose you could post your entire code so I could dissect what I'm doing wrong?

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>