HighTechTalks DotNet Forums  

NullReference Exception when using methods with generic parameters

Dotnet Framework (Remoting) microsoft.public.dotnet.framework.remoting


Discuss NullReference Exception when using methods with generic parameters in the Dotnet Framework (Remoting) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Dan Holmes
 
Posts: n/a

Default NullReference Exception when using methods with generic parameters - 04-27-2007 , 10:51 AM






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";
mgr.Add<TestContactInfo>(tci);

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

If i use this one i don't get the error
public void Add(ContactInfo contact)

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>
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()
{
}
}


Server stack trace:
at
System.Runtime.Remoting.Messaging.MethodCall.Resol veMethod(Boolean
bThrowIfNotResolved)
at System.Runtime.Remoting.Messaging.MethodCall..ctor (Object
handlerObject, BinaryMethodCallMessage smuggledMsg)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryMethodCall.ReadArray(Object[]
callA, Object handlerObject)
at
System.Runtime.Serialization.Formatters.Binary.Obj ectReader.Deserialize(HeaderHandler
handler, __BinaryParser serParser, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Serialization.Formatters.Binary.Bin aryFormatter.Deserialize(Stream
serializationStream, HeaderHandler handler, Boolean fCheck, Boolean
isCrossAppDomain, IMethodCallMessage methodCallMessage)
at
System.Runtime.Remoting.Channels.CoreChannel.Deser ializeBinaryRequestMessage(String
objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel
securityLevel)
at
System.Runtime.Remoting.Channels.BinaryServerForma tterSink.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.HandleRe turnMessage(IMessage
reqMsg, IMessage retMsg)
at
System.Runtime.Remoting.Proxies.RealProxy.PrivateI nvoke(MessageData&
msgData, Int32 type)
at IVS.Framework.IContactService.Add[T](Identity id, T contact)

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.