Bob Rundle
7/20/2004 11:01:00 PM
Yes, I tried this route also and it won't work. Getting events to work is
the hardest part of remoting. You want to obvious execute some code in the
client that the server doesn't know about. To do this you need an "event
wrapper".
Take a look at Sunny's code. It's how I got remote events to start working.
The example he has is very clean and tight. It's C# but you should be able
to translate it easily.
Regards,
Bob Rundle
"Sylvain Ross" <sross@free.fr> wrote in message
news:40fd8cc1$0$4211$626a14ce@news.free.fr...
> Thx Bob for your answer but I still have the problem :
>
> I created on my client a class derived of MarshallByRefObject named
> BlahClass, with only one sub "Blah" which display a messagebox for
> testing purpose.
>
> On my client form I instanciate an object from this class, and then write
:
> AddHandler myObj.myEvent,addressof myInstanceOfBlahClass.Blah
>
> But I still have the problem.
>
> Note that I created an other class that inherits from
> MarshallByRefObject because I can't do it directly on my Form since it's
> inheriting from Windows.Forms.Form
>
> Thx in advance.
>
>
>
> Bob Rundle wrote:
> > Most likely your handler is in a class not derived from MBR. In this
case
> > the server wants to instantiate the object and is complaining that it
can't
> > find the assembly so that it can instantiate the object.
> >
> > Bob Rundle
> >
> > "Sylvain Ross" <sross@free.fr> wrote in message
> > news:40fc7a83$0$29381$626a14ce@news.free.fr...
> >
> >>Hi,
> >>I'm trying to raise an event from a remote class to a client.
> >>
> >>Here is it :
> >>
> >>I got a remote server serving a class Hello.
> >>This class gots a public event defined like this
> >>Public event myEvent()
> >>
> >>Then, on my client, I'm able to retreive my remote object correctly
> >>(referenced by myObj).
> >>But when trying to add the handler like this :
> >>AddHandler myObj.myEvent,addressof aSubSomeWhere
> >>I have no compilation error but a runtime exception :
> >>
> >>
> >>
> >
> >
===========================================================================
> >
> >>System.IO.FileNotFoundException: File or assembly name Client, or one of
> >>its dependencies, was not found.
> >>File name: "Client"
> >>
> >>Server stack trace:
> >> at System.Reflection.Assembly.nLoad(AssemblyName fileName, String
> >>codeBase, Boolean isStringized, Evidence assemblySecurity, Boolean
> >>throwOnFileNotFound, Assembly locationHint, StackCrawlMark& stackMark)
> >> at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef,
> >>Boolean stringized, Evidence assemblySecurity, StackCrawlMark&
stackMark)
> >> at System.Reflection.Assembly.InternalLoad(String assemblyString,
> >>Evidence assemblySecurity, StackCrawlMark& stackMark)
> >> at System.Reflection.Assembly.Load(String assemblyString)
> >> at
> >>
> >
> >
System.Runtime.Serialization.FormatterServices.LoadAssemblyFromString(String
> >
> >>assemblyName)
> >> at System.DelegateSerializationHolder.GetDelegate(DelegateEntry de)
> >> at System.DelegateSerializationHolder.GetRealObject(StreamingContext
> >>context)
> >> at
> >>
> >
> >
System.Runtime.Serialization.ObjectManager.ResolveObjectReference(ObjectHold
> > er
> >
> >>holder)
> >> at System.Runtime.Serialization.ObjectManager.DoFixups()
> >> at
> >>
> >
> >
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(Head
> > erHandler
> >
> >>handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage
> >>methodCallMessage)
> >> at
> >>
> >
> >
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(S
> > tream
> >
> >>serializationStream, HeaderHandler handler, Boolean fCheck,
> >>IMethodCallMessage methodCallMessage)
> >> at
> >>
> >
> >
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(S
> > tream
> >
> >>serializationStream, HeaderHandler handler)
> >> at
> >>
> >
> >
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage
> > (String
> >
> >>objectUri, Stream inputStream, Boolean bStrictBinding)
> >> at
> >>
> >
> >
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IS
> > erverChannelSinkStack
> >
> >>sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream
> >>requestStream, IMessage& responseMsg, ITransportHeaders&
> >>responseHeaders, Stream& responseStream)
> >>
> >>Exception rethrown at [0]:
> >> at
> >>System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
> >>reqMsg, IMessage retMsg)
> >> at
> >>System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
> >>msgData, Int32 type)
> >> at PublishedClasses.IHelloClass.add_endOfAll(endOfAllEventHandler
obj)
> >> at Client.Form1.Button1_Click(Object sender, EventArgs e) in
> >>C:\Temp\RemotingClient\Client\Form1.vb:line 73
> >>
> >>Fusion log follows:
> >>=== Pre-bind state information ===
> >>LOG: DisplayName = Client, Version=1.0.1661.32062, Culture=neutral,
> >>PublicKeyToken=null
> >> (Fully-specified)
> >>LOG: Appbase = C:\Temp\RemotingServer\Server\bin> >>LOG: Initial PrivatePath = NULL
> >>Calling assembly : (Unknown).
> >>===
> >>
> >>LOG: Policy not being applied to reference at this time (private,
> >>custom, partial, or location-based assembly bind).
> >>LOG: Post-policy reference: Client, Version=1.0.1661.32062,
> >>Culture=neutral, PublicKeyToken=null
> >>LOG: Attempting download of new URL
> >>file:///C:/Temp/RemotingServer/Server/bin/Client.DLL.
> >>LOG: Attempting download of new URL
> >>file:///C:/Temp/RemotingServer/Server/bin/Client/Client.DLL.
> >>LOG: Attempting download of new URL
> >>file:///C:/Temp/RemotingServer/Server/bin/Client.EXE.
> >>LOG: Attempting download of new URL
> >>file:///C:/Temp/RemotingServer/Server/bin/Client/Client.EXE.
> >>
> >>
> >
> >
===========================================================================
> >
> >>
> >>If anyone got an idea, I don't even know if event a raisable remotely,
> >>are they ?
> >>
> >>
> >>Thx in advance
> >>
> >>Sylvain
> >
> >
> >