Quantcast
Channel: Visual Studio Integrate forum
Viewing all articles
Browse latest Browse all 4410

Extending what happens when a debug break is hit

$
0
0

I do a lot of number-crunching code work. Quite often I find myself wanting to trace the value of a variable and then plot its value in some window (typically Excel). I'm looking to do better than this. 

I've written a number of extensions for VS in the past, but what I'd REALLY like to do is to enable the execution of some external code whenever a debug break hits WITHIN visual studio. 

Example use case: 

for(int a .... a < n)
{

double r = SomeComplexFunction(params);

if(r > SOMEVALUE){   // DEBUG break point here. 

....

}

}

Where I have "DEBUG break point here" in the area above I want to actually append the variable 'r' to some list and then visualize the value later (after the loop has completed). But here's the catch, I don't want to have to write File.AppendAllText("C:\\somefile.csv", r.ToString() + "\r\n") to disk within the loop, close the application, and then open it up in Excel. this is bad because I'm WRITING code meant to debug stuff in my PRODUCTION code. It seems dirty. 

What I want is to quickly and easily aggregate data  my code encounters using extensions I write and run my own, internal visualization utilities against it (without injecting debug code into production code). How I could see this done is if I could trap a debug break point hit event (within my own extension), inspect the stack, take variables I'm interested in, and then do my own visualization. I could invent my own rule engine around it too.

Ideally I'd like to be able to use the same idea that VS already employs: right-mouse click on the debug break point and choose my extension. 

I'm not sure if what I'm asking makes sense other than I've got to believe my most common tasks could be automated someway via VS extensibility. 

So my question is really twofold: can this be done as I want to do it, and second: am I missing something within VS that already might allow me to do this? 

Thanks.  




Viewing all articles
Browse latest Browse all 4410

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>