Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Remoting / September 2004

Tip: Looking for answers? Try searching our database.

SerializationException with Remoting

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jason Schneekloth - 28 Sep 2004 01:47 GMT
OK, I'm working on making the simplest version of a remoting app that I
possibly can....basically, I'm trying to implement a Broker object to go
between a client and a server, so, I have a client and I have a server setup.
I have the server register the type IBroker with the system:

namespace Share
{
   public delegate void ServerToClient(string data);
   public delegate void ClientToServer(string data);

   public interface IBroker
   {
       event ServerToClient ServerToClientEvent;
       event ClientToServer ClientToServerEvent;

       void SendServer(string data);
       void SendClient(string data);
   }
}

I implement this server side as a Broker object.  No biggy.  I register it,
then right after I register it in the server, I get an instance of the
IBroker object (actually a Broker object, but just being consistent):

this.broker = (IBroker)Activator.GetObject(typeof(IBroker),
"tcp://localhost:8080/TheBroker");

this.broker.ClientToServerEvent += new
ClientToServer(broker_ClientToServerEvent);

On the call to "this.broker.ClientToServer += ....."  I get a
SerializationException thrown which has the following error:

"An unhandled exception of type
'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll

Additional information: Serialization will not deserialize delegates to
non-public methods."

I have no private delegates defined anywhere, everything is public.  I've
done some searching on the web, but still can't figure this out, please help!!

Jason Schneekloth
Sam Santiago - 28 Sep 2004 05:33 GMT
Is your event handler, broker_ClientToServerEvent, declared as public?  The
error seems to indicate it's declared as private.

Thanks,

Sam

Signature

_______________________________
Sam Santiago
ssantiago@n0spam-SoftiTechture.com
http://www.SoftiTechture.com
_______________________________

> OK, I'm working on making the simplest version of a remoting app that I
> possibly can....basically, I'm trying to implement a Broker object to go
[quoted text clipped - 39 lines]
>
> Jason Schneekloth
Robert Jordan - 28 Sep 2004 10:40 GMT
> OK, I'm working on making the simplest version of a remoting app that I
> possibly can....basically, I'm trying to implement a Broker object to go
[quoted text clipped - 37 lines]
> I have no private delegates defined anywhere, everything is public.  I've
> done some searching on the web, but still can't figure this out, please help!!

The event handler must be declared broker_ClientToServerEvent public
 ciao
Rob
Jason Schneekloth - 28 Sep 2004 19:05 GMT
Ok, so that problem was solved pretty easily, makes sense now...

I have a new problem, however, a new SerializationException is being thrown:

"An unhandled exception of type
'System.Runtime.Serialization.SerializationException' occurred in mscorlib.dll

Additional information: Cannot find the assembly Client,
Version=1.0.1732.21050, Culture=neutral, PublicKeyToken=null."

This is being thrown by the client on the call to add a new delegate to the
event:

this.broker.ServerToClientEvent += new
ServerToClient(broker_ServerToClientEvent);

Not sure what is going on here, it's running inside of the assembly it's
looking for, only other time I've come across this can't find assembly stuff
was when I'm instantiating objects outside of the current working directory
and I have to use AppendPrivatePath, but I can't see how I can use that here
(i tried, and it didn't seem to change anything)....any help here?

Jason
Ryan  Berry - 30 Sep 2004 15:16 GMT
Jason,

What you have to do is create a "shared" dll that is referenced by
both the "client" and the "server".  (Again, using the terms loosely,
as either parties can be a server or a client when using 2-way remoted
events.)  This shared dll would contain an interface implemented by the
"client" and referenced by the server to make calls on.  What's
happening (even if they're on the same machine) is that the server is
attempting to locate the library that contains the ibroker interface,
and fails.  I would put that interface into a seperate dll, and
reference it on both sides.

     -- Ryan Berry

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.