About

Ultralight framework to easily implement VisualStudio 2010 Intellitrace(tm) custom events

disclaimer: IntelliTrace is a trademark of Microsoft Corporation.

Inspired from the Guillaume Rouchon's blog entry, i have built this tiny set of attributes + regutil exe to programmatically update the VS2010 IntelliTrace CollectionPlan.xml file, which let IntelliTrace use your custom events.

Sample

  • Download the latest source code from codeplex
  • Open the solution which contains a demo project (IntelliTraceDemo).
tip: If you have not disabled UAC on Vista/Seven, you'll need to start VS2010 in administrator mode because the CollectionPlan.xml to update is under the ProgramFiles UAC-protected directory
  • Select IntelliTraceDemo-vs2010-fx40cp as startup project then run it. Its postbuild script registers two IntelliTrace custom events to the VS CollectionPlan.xml
  • Restart VS and reopen the solution (alas, the CollectionPlan.xml is loaded once per VS session..)
  • Run the IntelliTraceDemo-vs2010-fx40cp again until the Debugger.Break fires.
  • Look at the IntelliTrace panel. You should see the Event1(valueA,2) and Event2(valueB,4) custom events tracked by IntellTrace.

IntelliTrace panel

Locals captured by IntelliTrace

Usage

Events.cs source file in the IntelliTraceDemo shows how CollectionPlan.xml elements are defined using .NET attributes. Again, see Guillaume's -fascinating- blog for explanations.

using System;
using System.Diagnostics.IntelliTrace;

[assembly: Category("intellitrace.demo", "IntelliTraceContrib-Demo")]
[assembly: ModuleSpecification("Intellitrace-demo")]

namespace IntelliTraceDemo
{
    public static class Events
    {
        [DiagnosticEvent("DemoEvent1", "Demo - Event 1")]
        [Binding("Event1({0},{1})", "Event1 has occured (param1={0}, param2={1})")]
        public static void Event1(
            [DataQuery(MaxSize = 20)]
            string param1,
            [DataQuery]
            int param2)
        {
        }

        [DiagnosticEvent("DemoEvent2", "Demo - Event 2")]
        [Binding("Event2({0},{1})", "Event2 has occured (param1={0}, param2={1})")]
        public static void Event2(
            [DataQuery(MaxSize = 20)]
            string param1,
            [DataQuery]
            int param2)
        {
        }
    }
}

Projects using IntelliTraceContrib

Last edited Jul 2, 2010 at 12:22 AM by JazBee, version 6