Bug 320787 (MONO78039) - Getting error message when creating instance of a Client Activated Object (CAO)
Summary: Getting error message when creating instance of a Client Activated Object (CAO)
Status: RESOLVED MOVED
Alias: MONO78039
Product: Mono: Runtime
Classification: Mono
Component: remoting (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Minor
Target Milestone: ---
Assignee: Lluis Sanchez
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-07 08:58 UTC by Diego Alfonso Flórez
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
This .zip contains the source code of the Client/Server Application that works on Visual Studio .NET and doesn't work on Mono (37.68 KB, application/octet-stream)
2006-04-07 20:05 UTC, Thomas Wiest
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 19:54:22 UTC


---- Reported by diegoflorez84@gmail.com 2006-04-07 01:58:09 MST ----

Please fill in this template when reporting a bug, unless you know what you
are doing.
Description of Problem:
Mono throws an error message (Exception) when the client of a Client/Server
application that uses Remoting, creates an instance of a Client Activated
Object (CAO).

Steps to reproduce the problem:
1. Create a Client/Server application that uses Remoting.
2. In the server, register a service for a CAO.
3. In the client, try to create an instance of that CAO.

Actual Results:
When the application crashes, Mono shows an error like this:

Unhandled Exception: System.Reflection.TargetInvocationException: Exception
has been thrown by the target of an invocation. --->
System.Runtime.Remoting.RemotingException: Requested service not found
(System.Runtime.Remoting.Activation.IActivator, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089). No
receiver for uri remApp/RemoteActivationService.remin [0x00188] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs:219)
System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
(System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg,
System.Exception exc, System.Object[] out_args)

Expected Results:
The application shouldn't crash. The instance of the CAO should be created.

How often does this happen? 
Always.

Additional Information:
N/A.



---- Additional Comments From diegoflorez84@gmail.com 2006-04-07 02:03:28 MST ----

Here's the code of the Client/Server Application:

//Object
using System;

namespace RemotingApp
{
    public class RemotingObj : MarshalByRefObject
    {
        int number = 5;
       
        public int calculate()
        {
            return number * number * number;
        }
    }
}

//Server
using System;
using System.Data;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;

namespace RemotingApp
{
    class Server
    {
        public static void Main(string[] args)
        {
            ChannelServices.RegisterChannel(new TcpChannel(8888));
           
            //Registering a Server Activated Object (SAO) --> works on
client
           
RemotingConfiguration.RegisterWellKnownServiceType(typeof(RemotingApp.RemotingObj),
"RemotingObj", WellKnownObjectMode.Singleton);
           
            //Registering a Client Activated Object (CAO) --> doesn't
work on client
            RemotingConfiguration.ApplicationName = "remApp";
           
RemotingConfiguration.RegisterActivatedServiceType(typeof(RemotingApp.RemotingObj));
           
            Console.WriteLine("Executing Server... press Enter to
finish");
            Console.ReadLine();
        }
    }
}

//Client
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Tcp;
using System.Runtime.Remoting.Activation;

namespace RemotingApp
{
    class Client
    {
        public static void Main(string[] args)
        {
            ChannelServices.RegisterChannel(new TcpChannel());
           
            //Using Server Activated Object (SAO) --> works OK
            RemotingObj ob1 = (RemotingObj)
Activator.GetObject(typeof(RemotingApp.RemotingObj),
"tcp://localhost:8888/RemotingObj");
            Console.WriteLine(ob1.calculate());
           
            //Using Client Activated Object (CAO) --> doesn't work
            object[] attrs = {new
UrlAttribute("tcp://localhost:8888/remApp")};
            ObjectHandle handle =
Activator.CreateInstance("RemotingObj", "RemotingApp.RemotingObj", attrs);
            RemotingObj ob2 = (RemotingObj) handle.Unwrap();
           
            Console.WriteLine(ob2.calculate());
        }
    }
}

This is the error message appears when the application crashes:

Unhandled Exception: System.Reflection.TargetInvocationException:
Exception has been thrown by the target of an invocation. --->
System.Runtime.Remoting.RemotingException: Requested service not found
(System.Runtime.Remoting.Activation.IActivator, mscorlib,
Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089).
No receiver for uri remApp/RemoteActivationService.remin [0x00188] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs:219)
System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
(System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg,
System.Exception exc, System.Object[] out_args)

Exception rethrown at [1]:

in [0x00188] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System.Runtime.Remoting.Proxies/RealProxy.cs:219)
System.Runtime.Remoting.Proxies.RealProxy:PrivateInvoke
(System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg,
System.Exception exc, System.Object[] out_args)--- End of inner
exception stack trace ---

in [0x0006b] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System.Reflection/MonoMethod.cs:353)
System.Reflection.MonoCMethod:Invoke (System.Object obj, BindingFlags
invokeAttr, System.Reflection.Binder binder, System.Object[]
parameters, System.Globalization.CultureInfo culture)
in [0x0011d] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System/Activator.cs:226)
System.Activator:CreateInstance (System.Type type, BindingFlags
bindingAttr, System.Reflection.Binder binder, System.Object[] args,
System.Globalization.CultureInfo culture, System.Object[]
activationAttributes)
in [0x00030] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System/Activator.cs:149)
System.Activator:CreateInstance (System.String assemblyName,
System.String typeName, Boolean ignoreCase, BindingFlags bindingAttr,
System.Reflection.Binder binder, System.Object[] args,
System.Globalization.CultureInfo culture, System.Object[]
activationAttributes, System.Security.Policy.Evidence securityInfo)
in [0x00024] (at
/tmp/scratch/BUILD/mono-1.1.14/mcs/class/corlib/System/Activator.cs:136)
System.Activator:CreateInstance (System.String assemblyName,
System.String typeName, System.Object[] activationAttributes)
in [0x0004e] (at
/home/diegoflorez84/Projects/BORRAME/Client/Client.cs:22)
RemotingApp.Client:Main (System.String[] args)




---- Additional Comments From robertj@gmx.net 2006-04-07 09:54:52 MST ----

Does it work if you omit

    RemotingConfiguration.ApplicationName = "remApp";

and use this uri:

    object[] attrs = {new
UrlAttribute("tcp://localhost:8888/")}?

It might be related to https://bugzilla.novell.com/show_bug.cgi?id=MONO76809




---- Additional Comments From robertj@gmx.net 2006-04-07 10:49:42 MST ----

Your sample is invalid and doesn't work on MS.NET either.
Please attach a self containing test case with build instructions.
Thanks!




---- Additional Comments From diegoflorez84@gmail.com 2006-04-07 13:05:52 MST ----

Created an attachment (id=169546)
This .zip contains the source code of the Client/Server Application that works on Visual Studio .NET and doesn't work on Mono




---- Additional Comments From diegoflorez84@gmail.com 2006-04-07 13:10:12 MST ----

Robert Jordan, I sent a .zip file that contains the .cs files, so 
you can run the application in Visual Studio .NET. I tried it just 
before I sent it. You have to run the server, then run the client 
and that's it ;-)

Please inform me if it doesn't run (maybe it's because the DLL 
references), thanks.



---- Additional Comments From robertj@gmx.net 2006-04-07 17:09:09 MST ----

Thanks, I got it. It's related to https://bugzilla.novell.com/show_bug.cgi?id=MONO76809.

It works using this URL on both MS.NET and Mono:

object[] attrs = {new
UrlAttribute("tcp://localhost:8888")}





---- Additional Comments From robertj@gmx.net 2006-04-07 18:07:47 MST ----



*** This bug has been marked as a duplicate of https://bugzilla.novell.com/show_bug.cgi?id=MONO76809 ***

Imported an attachment (id=169546)

Unknown bug field "cf_op_sys_details" encountered while moving bug
   <cf_op_sys_details>Fedora Core 4</cf_op_sys_details>
Unknown operating system unknown. Setting to default OS "Other".
This bug was marked DUPLICATE in the database it was moved from.
    Changing resolution to "MOVED"