D
Denny
I have noticed this weird behavior and wondered if anyone else has seen this or knows a solution. I have this class that inherits from NameObjectCollectionBase that has one public property (name):
Private _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Sub New()
End Sub
Protected Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
MyBase.New(info, context)
End Sub
The server object creates, sets the name property and returns it
From the server:
Inherits MarshalByRefObject
Implements IEmployee.IEmployee
Public Function GetEmployee() As Employee.Employee Implements IEmployee.IEmployee.GetEmployee
Dim TestEmployee As New Employee.Employee
TestEmployee.Name = "Harry"
Return TestEmployee
End Function
From the client:
ServerEmployee = DirectCast(Activator.GetObject(GetType(IEmployee.IEmployee), URL.ToString), IEmployee.IEmployee)
Dim Employee As New Employee.Employee
Employee = ServerEmployee.GetEmployee
The problem is when the client recieves the object, its name property = "". I have double checked this and when the object is created on the server, the property is set. I have tried it with other collections and it works as expected, the problem seems to be any classes that derive from Collections.Specialized namespace. All of the base properties retain settings. Only properties in the inherited class seem not to retain their settings.
Does anyone see something I am missing?
Thanks.
Private _name As String
Public Property Name() As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Public Sub New()
End Sub
Protected Sub New(ByVal info As System.Runtime.Serialization.SerializationInfo, ByVal context As System.Runtime.Serialization.StreamingContext)
MyBase.New(info, context)
End Sub
The server object creates, sets the name property and returns it
From the server:
Inherits MarshalByRefObject
Implements IEmployee.IEmployee
Public Function GetEmployee() As Employee.Employee Implements IEmployee.IEmployee.GetEmployee
Dim TestEmployee As New Employee.Employee
TestEmployee.Name = "Harry"
Return TestEmployee
End Function
From the client:
ServerEmployee = DirectCast(Activator.GetObject(GetType(IEmployee.IEmployee), URL.ToString), IEmployee.IEmployee)
Dim Employee As New Employee.Employee
Employee = ServerEmployee.GetEmployee
The problem is when the client recieves the object, its name property = "". I have double checked this and when the object is created on the server, the property is set. I have tried it with other collections and it works as expected, the problem seems to be any classes that derive from Collections.Specialized namespace. All of the base properties retain settings. Only properties in the inherited class seem not to retain their settings.
Does anyone see something I am missing?
Thanks.