I am having an issue with reading a property over a .NET remoting channel. Here is the beginning of my class:
[Serializable]
public class MachineID
{
private string mySystemDeviceSerial = null;
/// <summary>
/// Returns the hard drive serial that Windows is installed on.
/// </summary>
public string SystemDeviceSerial
{
get { return mySystemDeviceSerial; }
}
private string mySystemName = null;
/// <summary>
/// Returns the current name of the system.
/// </summary>
public string SystemName
{
get { return mySystemName; }
}
private string myLastError = string.Empty;
/// <summary>
/// Returns the last error that occurred. Returns string.Empty if no error has occurred.
/// </summary>
public string LastError
{
get { return myLastError; }
}
private int myPort = -2;
public int Port
{
get { return this.myPort; }
set { this.myPort = value; }
}
All properties are accessible just fine on the local machine. However, when I try to read the Port property from a client over a .NET remoting channel, I do not get the value that has been assigned to myPort, but rather, the initial value of -2. I am stumped on this, as the all of the string properties are able to be read fine. Any ideas? Am I not serializing this class properly?
It is worthy to note that all I have done to make this class and members serializable is add the [Serializable] attribute at the top of the class. I am not sure if this is the proper way to do this, so perhaps this could be a part of the issue?