Question Private property visible when it shouldn't be...

thor69uk

New member
Joined
Jan 3, 2010
Messages
2
Programming Experience
3-5
Hi guys,
Got a strange question and wondering if someone can point out what I am doing wrong?

I'm using VS2008 and have created a dll with the following code:

VB.NET:
Public Class Test

    Private privatesampleProperty As String

    Public Property SampleProperty() As String
        Get
            Return privatesampleProperty
        End Get
        Set(ByVal value As String)
            privatesampleProperty = value
        End Set
    End Property
End Class

I built this and then created a new project in VB, standard settings. I then add a reference to the above .dll and then when I run the following code in the Form1_Load sub:

VB.NET:
Dim test as New Test
test.SampleProperty = "TestSample"

I have visibility of the internal private property of the class in the dll. :confused:

Image.png


Please can someone tell me what the heck I have forgotten to be able to see the private property??? From what I can see this should not be visible outside the class...

Anyone? Or am I missing something obvious here???

Thanks in advance,

Andy
 
Last edited:
Fixed

Finally after many days of digging I have been provided the answer which I will share here incase any one else has the same problem.

When the dll was created in VB 2008 it by default turns on the 'Generate debugging info' option (which is set in the Project properties > Compile > Advanced Compiler options form)

Even if you move the dll out of the debug or the release folder so there is no 'associated' .pdb file, VS 2008 still very kindly finds it for you.

So, ensure that you have set the debug info off and the problem goes away!

Everyday is a school day! :)

Thanks,

Andy
 
Last edited:
Back
Top