I am attempting to code/debug a powershell script within vs2015, having installed the PowerShellTools.14.0.vsix addon. (Note, this is happening inside a VM, running Windows Server 2008 R2, powershell version 3.0)
All is working well, save that I am unable to debug XML resources. I cannot see into the XML objects. Variables in the watch window contain no relevant data (unless you call the XMLElement hierarchy relevant). Conversion to other types, like JSON also seem to provide no help.
Here's some sample code...
$r = Invoke-SafeWebRequest -Uri $url
[xml]$xml = $r
Invoke-SafeWebRequest
is a simple wrapper around Invoke-WebRequest
to handle non-200-ok status returns from REST-ish web services. It always returns a simple string
Here's what the watch window looks like. As you can see, there's no data, other than structure here.
What I'm expecting to see in that watch window, is some kind of visualization of the XML data.
I've also tried a few alternatives for loading the XML data into an XML object, and I haven't seen any different behavior, except for this one:
$y = New-Object -TypeName System.Xml.XmlDocument
$y.LoadXml($r)
Which looks like this in the watch window..
I am somewhat confused that the New-Object
I created doesn't seem to have the type that I asked it to have. But at least this object will let me see inner text, etc. But, again, when I try to examine the child nodes, I get the same behavior again (as with the first screenshot), and I'm unable to see the actual data returned.
Am I somehow loading the data into XML incorrectly? Shouldn't I be able to visualize this data easily? Is there something else I'm missing?
As near as I can tell, this appears to be a bug with Powershell Tools.
Adam Driscoll says "We aren't really expanding the XmlElement nodes correctly." And a bug was logged on September 17, 2015... it is open at the time of this post.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.