Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to dump a stream from the debugger in VS

I'm using VS 2010 and am working with a lot of streams in C# in my current project. I've written some stream dump utilities for writing out certain types of streams for debugging purposes, but I seem to keep stumbling across times when I am debugging and need to look into the stream I am debugging over, but I didn't put my dump calls in there. It seems like I should be able to dump the stream somehow just using VS or maybe tell it to call one of my dump methods on a stream in the debugger. Is there a wy to do this?

The streams I am working with have some text describing a blob of data and then the bytes of the blob, so looking at the description is useful. My dump methods typically just dump that information out and then skip the blobs.

like image 486
MikeD Avatar asked Nov 25 '09 19:11

MikeD


People also ask

What is Debug stream?

The Streams Debugger provides the following abilities to observe and change the data as it flows in the application: Setting breakpoints to suspend thread execution when a tuple arrives at a port. Updating tuple values before your application continues execution of a stopped breakpoint.

How do I Debug an entire solution in Visual Studio?

Press F5 and start debugging the solution B instance of Visual Studio. Then press F5 and start debugging the solution A instance of Visual Studio. Now both the instances of Visual Studio will be in debug mode.

Does Visual Studio have a debugger?

The Visual Studio debugger can help you navigate through code to inspect the state of an app and show its execution flow, which is also known as code stepping. You can use keyboard shortcuts, debug commands, breakpoints, and other features to quickly get to the code you want to examine.


2 Answers

Type this into the Immediate Window:

System.Diagnostics.Debug.WriteLine((new System.IO.StreamReader(stream)).ReadToEnd());
like image 153
James Avatar answered Sep 28 '22 21:09

James


Maybe you could write a Visualizer? MSDN explains how here: http://msdn.microsoft.com/en-us/library/e2zc529c.aspx

like image 34
David Silva Smith Avatar answered Sep 28 '22 21:09

David Silva Smith