google google - 14 days ago 8
Vb.net Question

DebuggerDisplay gives error: 'Reference to a non-shared member requires an object reference'

Say I have this code:

Public Class Bear

Public ReadOnly Property prop() As String
Get
Return "text"
End Get
End Property

End Class

<DebuggerDisplay("{Bear.prop}")> _
Public Class foo

Public ReadOnly Property Bear() As Bear
Get
Return New Bear
End Get
End Property

End Class


When I create an instance of
Foo
DebuggerDisplay shows me in the TooTip this error:
Reference to a non-shared member requires an object reference


I wrote the same code in C# and there was no error.

This happens because the
Bear
is also a property name and Type name.

There is an idea to solve? Why I can't see value of
prop
in the tooltip?

Answer

This is a Bug in Visual Studio 2010. Use Visual Studio 2015.

Comments