[Mono-bugs] [Bug 555203] New: Remoting - Passing a nested Object causes a "Object reference not set error"

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Nov 13 04:29:15 EST 2009


           Summary: Remoting - Passing a nested Object causes a "Object
                    reference not set error"
    Classification: Mono
           Product: Mono: Runtime
           Version: 2.4.x
          Platform: x86
        OS/Version: openSUSE 11.1
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: remoting
        AssignedTo: lluis at novell.com
        ReportedBy: info at hematec.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---

User-Agent:       Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; GTB6; .NET
CLR 2.0.50727; .NET CLR 1.1.4322; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022;
NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)

passing a nested clientactivated object from a serveractivated object within
another object causes an "Object reference not set" Error.

Example structure:

Using TCP-Channel and binary formatters.
The SAO and CAO are exposed not directly but through Interfaces
(IRemotedClientFactory & IRemotedClientObject) defined in a shared DLL.
The Server holds the classes for the ClientFactory and the RemotedClientObject
(these are not shared to the client).
The client will get the clientobject by calling a function of the remoted
factory (this is because to avoid providing the clientobjects code to the
The clientobject exposes the method and functions to the clients.

example Source: 

* Shared DLL * 
Public Interface IRemotedClientFactory 
    Function Reachable() As Boolean 
    Function GetClientObject(ByVal sDataSourceName As String, ByVal sServerIP
As String) As FactoryReturnObject 
    Event NotifyEvent As FactoryNotificationEventHandler 
End Interface 

Public Interface IRemotedClientObject 
    Function Execute(ByVal sCommand As String, ByVal oParams() As Object) As
    Function AreUAlive() As Boolean 
End Interface 
<Serializable()> _ 
Public Class FactoryReturnObject 
    Inherits MarshalByRefObject 

    Public IsSuccess As Boolean = False 
    Public ErrorID As Integer = -1 
    Public ErrorMessage As String = "" 
    Public ClientObject As IRemotedClientObject 

    Public Sub New(ByVal oClientObject As IRemotedClientObject) 
        IsSuccess = True 
        ClientObject = oClientObject 
    End Sub 

    Public Sub New(ByVal iErrID As Integer, ByVal sErrMsg As String) 
        IsSuccess = False 
        ErrorID = iErrID 
        ErrorMessage = sErrMsg 
    End Sub 
End Class 

* Server * 
public class RemotedClientFactory : MarshalByRefObject,

        public RemotePresenterDLL.FactoryReturnObject GetClientObject(string
sClientID, string sServerIP) 
            // This is called by the client to get the clientobject 
            // return object 
            return new RemotePresenterDLL.FactoryReturnObject(new
RemotedClientObject(sClientIP, sClientID)); 

public class RemotedClientObject : MarshalByRefObject,
        public Boolean AreUAlive() 
            // This causes the error !!! 
            return true; 

* Client * 
// Vars 
RemotePresenterDLL.IRemotedClientFactory  m_oFactory; 
RemotePresenterDLL.IRemotedClientObject  m_oRemotedClient; 
RemotePresenterDLL.FactoryReturnObject oFactRet; 

private void Connect() 
    m_oFactory =
"<NameOfTCPChannel>") as RemotePresenterDLL.IRemotedClientFactory; 
    oFactRet = m_oFactory.GetClientObject(<>,<>); 
    m_oRemotedClient = oFactRet.ClientObject; 
    oFactRet.ClientObject = null; // Needs to be set under Win because of
GarbColl in Server!! 

    // This call causes the error !! 
    bTmp = m_oRemotedClient.AreUAlive(); 

Reproducible: Always

Steps to Reproduce:
1. Run the Server which exposes the remoted objects (factory for CAO)
2. Run the client which request the CAO by calling the factories function
3. Call the CAO AreUAlive-Function
Actual Results:  
Object reference not set error 

Expected Results:  
getting a result of the called function (true)

Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.

More information about the mono-bugs mailing list