Justin R.
Justin R.

Reputation: 24041

Viewing the output of Visual Studio's XSLT debugger

I'm using Visual Studio to debug a transform. If I am viewing the transform and select XML > Start XSLT Debugging, VS automatically opens the output file and as I step through the transform I can observe the output being written.

In my case however, because the transform is performed by an application that first sets some parameters, I am instead entering the XSLT debugger using the following code:

XslCompiledTransform xslTransform = new XslCompiledTransform(true); // enableDebug
XmlUrlResolver urlResolver = new XmlUrlResolver();
XsltSettings xsltSettings = new XsltSettings(true, true);
XsltArgumentList transformArgumentList = new XsltArgumentList();
// some arguments are set here
xslTransform.Load(transformFilePath, xsltSettings, urlResolver);             
using (XmlWriter writer = XmlWriter.Create(outputFilePath))
{
    xslTransform.Transform(inputFile, transformArgumentList, writer, urlResolver);
}

A breakpoint is set on the call to Transform. After starting the debugger, it breaks on Transform as expected. When I use F11 / Debug > Step Into, I enter the XSLT file and can step through it, but I cannot see its output.

Is there an option that I need to set in order to view the output as it is written, like in the former mode?

Upvotes: 2

Views: 2236

Answers (3)

Devin Gleason Lambert
Devin Gleason Lambert

Reputation: 1730

Not sure if this will help anyone, but here is Microsoft's "How to: Start Debugging XSLT" http://msdn.microsoft.com/en-us/library/ms255603%28v=vs.110%29.aspx

Upvotes: 0

Frank Hoffman
Frank Hoffman

Reputation: 950

I'm not sure you can examine the stream in the debugger. Once XSLT debugging begins, you're no longer in the .NET world. My locals window only shows XSLT elements.

I made a feature request if you want to vote it up.

Upvotes: 2

Justin
Justin

Reputation: 86729

Unfortunately not that I am aware of.

I have to admit that I don't often need this, however you could replace writer with a MemoryStream backing stream (conditionally when debugging) which would at least allow you to see the xml output by examining the stream in the debugger.

Upvotes: 0

Related Questions