问题
I'm new to this and working from a tutorial. I have a variation on the following code:
Dim xDoc As XPathDocument
Dim xNav As XPathNavigator
xDoc = New XPathDocument("xxxxxxx.xml")
xNav = xDoc.CreateNavigator()
However, "CreateNavigator" returns: 'debuggerDisplayProxy' is a type and cannot be used as an expression.
I've Googled and searched and found nothing (although I'm not really sure what to look for). This seems like something basic and it's stopping me from continuing with a lot of other stuff that I know works!
回答1:
It is not a real error, the debugger has a problem with the attribute on the class:
<DebuggerDisplay("{debuggerDisplayProxy}")> _
Public MustInherit Class XPathNavigator
'' etc..
End Class
The name is spelled wrong, it should be "DebuggerDisplayProxy" with a capital D. For some reason this only goes wrong in VB.NET, this isn't a problem in C# so that's probably why it hasn't been fixed yet. Just keep clicking on the [+] to see the internal members of the object. And keep going, there's nothing wrong with your code.
I filed this as a bug report at Connect.
来源:https://stackoverflow.com/questions/10523900/vb-net-xpathdocument-createnavigator-throws-debuggerdisplayproxy-error