mail-archives/mono-bugs/2009-November/094951.html

277 строки
7.5 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE> [Mono-bugs] [Bug 555203] New: Remoting - Passing a nested Object causes a &quot;Object reference not set error&quot;
</TITLE>
<LINK REL="Index" HREF="index.html" >
<LINK REL="made" HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20555203%5D%20New%3A%20Remoting%20-%20Passing%20a%20nested%20Object%0A%20causes%20a%20%22Object%20reference%20not%20set%20error%22&In-Reply-To=">
<META NAME="robots" CONTENT="index,nofollow">
<META http-equiv="Content-Type" content="text/html; charset=us-ascii">
<LINK REL="Previous" HREF="094949.html">
<LINK REL="Next" HREF="094953.html">
</HEAD>
<BODY BGCOLOR="#ffffff">
<H1>[Mono-bugs] [Bug 555203] New: Remoting - Passing a nested Object causes a &quot;Object reference not set error&quot;</H1>
<B>bugzilla_noreply at novell.com</B>
<A HREF="mailto:mono-bugs%40lists.ximian.com?Subject=%5BMono-bugs%5D%20%5BBug%20555203%5D%20New%3A%20Remoting%20-%20Passing%20a%20nested%20Object%0A%20causes%20a%20%22Object%20reference%20not%20set%20error%22&In-Reply-To="
TITLE="[Mono-bugs] [Bug 555203] New: Remoting - Passing a nested Object causes a &quot;Object reference not set error&quot;">bugzilla_noreply at novell.com
</A><BR>
<I>Fri Nov 13 04:29:15 EST 2009</I>
<P><UL>
<LI>Previous message: <A HREF="094949.html">[Mono-bugs] [Bug 550736] crash with remoting, error: file icall.c: line 3182 (ves_icall_InternalExecute)
</A></li>
<LI>Next message: <A HREF="094953.html">[Mono-bugs] [Bug 551666] Gridview does not render thead in ASP.NET
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#94951">[ date ]</a>
<a href="thread.html#94951">[ thread ]</a>
<a href="subject.html#94951">[ subject ]</a>
<a href="author.html#94951">[ author ]</a>
</LI>
</UL>
<HR>
<!--beginarticle-->
<PRE><A HREF="http://bugzilla.novell.com/show_bug.cgi?id=555203">http://bugzilla.novell.com/show_bug.cgi?id=555203</A>
Summary: Remoting - Passing a nested Object causes a &quot;Object
reference not set error&quot;
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: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">lluis at novell.com</A>
ReportedBy: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">info at hematec.de</A>
QAContact: <A HREF="http://lists.ximian.com/mailman/listinfo/mono-bugs">mono-bugs at lists.ximian.com</A>
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 &quot;Object reference not set&quot; Error.
Example structure:
Using TCP-Channel and binary formatters.
The SAO and CAO are exposed not directly but through Interfaces
(IRemotedClientFactory &amp; 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
client-app).
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
Object
Function AreUAlive() As Boolean
End Interface
..
&lt;Serializable()&gt; _
Public Class FactoryReturnObject
Inherits MarshalByRefObject
Public IsSuccess As Boolean = False
Public ErrorID As Integer = -1
Public ErrorMessage As String = &quot;&quot;
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,
RemotePresenterDLL.IRemotedClientFactory
{
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,
RemotePresenterDLL.IRemotedClientObject
{
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 =
Activator.GetObject(typeof(RemotePresenterDLL.IRemotedClientFactory),
&quot;&lt;NameOfTCPChannel&gt;&quot;) as RemotePresenterDLL.IRemotedClientFactory;
oFactRet = m_oFactory.GetClientObject(&lt;&gt;,&lt;&gt;);
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: <A HREF="http://bugzilla.novell.com/userprefs.cgi?tab=email">http://bugzilla.novell.com/userprefs.cgi?tab=email</A>
------- You are receiving this mail because: -------
You are the QA contact for the bug.
</PRE>
<!--endarticle-->
<HR>
<P><UL>
<!--threads-->
<LI>Previous message: <A HREF="094949.html">[Mono-bugs] [Bug 550736] crash with remoting, error: file icall.c: line 3182 (ves_icall_InternalExecute)
</A></li>
<LI>Next message: <A HREF="094953.html">[Mono-bugs] [Bug 551666] Gridview does not render thead in ASP.NET
</A></li>
<LI> <B>Messages sorted by:</B>
<a href="date.html#94951">[ date ]</a>
<a href="thread.html#94951">[ thread ]</a>
<a href="subject.html#94951">[ subject ]</a>
<a href="author.html#94951">[ author ]</a>
</LI>
</UL>
<hr>
<a href="http://lists.ximian.com/mailman/listinfo/mono-bugs">More information about the mono-bugs
mailing list</a><br>
</body></html>