Instrumenting a string

Posted by George Polevoy on Stack Overflow See other posts from Stack Overflow or by George Polevoy
Published on 2010-05-14T17:22:34Z Indexed on 2010/05/14 17:24 UTC
Read the original article Hit count: 223

Somewhere in C++ era i have crafted a library, which enabled string representation of the computation history. Having a math expression like:

TScalar Compute(TScalar a, TScalar b, TScalar c)
{
 return ( a + b ) * c;
}

I could render it's string representation:

r = Compute(VerbalScalar("a", 1), VerbalScalar("b", 2), VerbalScalar("c", 3));
Assert.AreEqual(9, r.Value);
Assert.AreEqual("(a+b)*c==(1+2)*3", r.History );

C++ operator overloading allowed for substitution of a simple type with a complex self-tracking entity with an internal tree representation of everything happening with the objects.

Now i would like to have the same possibility for NET strings, only instead of variable names i would like to see a stack traces of all the places in code which affected a string.

And i want it to work with existing code, and existing compiled assemblies.

Also i want all this to hook into visual studio debugger, so i could set a breakpoint, and see everything that happened with a string.

Which technology would allow this kind of things?

I know it sound like an utopia, but I think visual studio code coverage tools actually do the same kind of job while instrumenting the assemblies.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about msil