NullReference Exception inside remoting

D

Dan Holmes

I traced this all the to the domain boundary. I also but a breakpoint
in the server. That was never hit. It happens after it leaves the
client but before it calls into the "add" method in the server. I don't
know how to debug this any further.

exact error message and code follows

this is what fails. it fails on the add.
TestContactInfo tci = new TestContactInfo();
tci.Address1 = "address1";
tci.Address2 = "address2";
tci.Address3 = "address3";
tci.Address4 = "address4";
tci.City = "City";
tci.Comment = "Comment";
tci.ContactFor = contactFor;
tci.ContactID = contactID;
tci.Country = "Country";
tci.Email = "Email";
tci.Fax1 = "Fax1";
tci.Fax2 = "Fax2";
tci.Name = "Name";
tci.Phone1 = "Phone1";
tci.Phone2 = "Phone2";
tci.PostalCode = "PostalCode";
tci.State = "State";
tci.Title = "Title";
tci.Url = "Url";
Assert.IsTrue(tci.IsDirty(), "Should be dirty");
tci.ResetDirty();
Assert.IsFalse(tci.IsDirty(), "Should not be dirty");
mgr.Add<TestContactInfo>(tci);

this is the signature for the add method
public void Add<T>(T contact) where T : ContactInfo

public abstract class ContactInfo : IData
{
protected ContactInfo originalData;
/// <summary>
/// </summary>
/// <remarks>Sets the initial values so that the IsDirty method
works if the data is changed after population</remarks>
public virtual bool IsDirty()
{
return !(originalData.Address1.Equals(Address1)
&& originalData.Address2.Equals(Address2)
&& originalData.Address3.Equals(Address3)
&& originalData.Address4.Equals(Address4)
&& originalData.City.Equals(City)
&& originalData.Comment.Equals(Comment)
&& originalData.ContactID.Equals(ContactID)
&& originalData.Country.Equals(Country)
&& originalData.Email.Equals(Email)
&& originalData.Fax1.Equals(Fax1)
&& originalData.Fax2.Equals(Fax2)
&& originalData.Name.Equals(Name)
&& originalData.Phone1.Equals(Phone1)
&& originalData.Phone2.Equals(Phone2)
&& originalData.PostalCode.Equals(PostalCode)
&& originalData.State.Equals(State)
&& originalData.Title.Equals(Title)
&& originalData.Url.Equals(Url)
);
}
public virtual void ResetDirty()
{
originalData = (ContactInfo)MemberwiseClone();
}
private string _contactID = string.Empty;

public string ContactID
{
get { return _contactID; }
set { _contactID = value; }
}
//insert more properties here. snipped for brevity
}

[Serializable]
public class TestContactInfo : ContactInfo
{
public TestContactInfo()
{
ResetDirty();
}
}


Server stack trace:
at
System.Runtime.Remoting.Messaging.MethodCall.ResolveMethod(Boolean
bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall..ctor(Object
handlerObject, BinaryMethodCallMessage smuggledMsg)
at
System.Runtime.Serialization.Formatters.Binary.BinaryMethodCall.ReadArray(Object[]
callA, Object handlerObject)
at
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String
objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel
securityLevel)
at
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
requestStream, IMessage& responseMsg, ITransportHeaders& respon
seHeaders, Stream& responseStream)

Exception rethrown at [0]:
at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
at IVS.Framework.IContactService.Add[T](Identity id, T contact)
 
D

Dan Holmes

Dan said:
I traced this all the to the domain boundary. I also but a breakpoint
in the server. That was never hit. It happens after it leaves the
client but before it calls into the "add" method in the server. I don't
know how to debug this any further. ....

this is the signature for the add method
public void Add<T>(T contact) where T : ContactInfo

i changed that to: public void Add(ContactInfo contact) and it works.
Essentially removing the generic markers.

anyone know why?

dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top