an event on an object being serialized would be serialized too. (If a
handles b's event, when b is serialized, a is serialized along with it). The
hierarchy attaching itself to my event. A nice solution would be to mark the
I'm experiencing. I hope you find an explanation or solution.
"Gery D. Dorazio" <gdorazio@enque.net> wrote in message
news:OaioDLOjDHA.220@tk2msftngp13.phx.gbl...
> Hi folks,
>
> This problem looks very much like a related situation in what appears to
be
> a loss of state in the server object with many of the remoting
> samples...ones that instantiate a Singleton object forever on the server
and
> then have multiple clients access it... In this problem, losing the
> reference to the event handler appears to be the same thing. I have also
> lost the same type of reference to event handlers.
>
> In a generalized case, if you start a server and leave it running and then
> start a client, let it do its thing and then start another client, it
> appears to have reinitialized the server instances objects - except the
> serializable ones like strings. (If anyone is interested I have a project
I
> can email to you to demonstrate.)
>
> However, I am beginning to think that this situation is by design and that
> there really isn't a problem here. In the MS documentation it states that
> when designing remotable classes the designer must insure that the class
> properly handles security since remotable objects cross process boundries
> and/or app domains. Although the framework handles security for local
apps,
> it doesn't automatically extend to remotable types because the security
> context can be outside the local machines control. It wouldn't necessarily
> throw a security exception because the framework doesn't know your
> intentions about the use of the fields or references in your class. This
> idea is hinted at because between framework 1.0 and 1.1 the security
> restrictions were tightened and now you have to add the
> typeFilterLevel="Full" attribute to the formatter. Otherwise, some apps
> developed in 1.0 will give a security exception in 1.1.
>
> I do not know if this is the problem here and this may be an incorrect
> rabbit trail. But the thought here is that when a second instance of a
> client is instantiated, a second singleton object is also instantiated
> because the first instance is/was used for the first client and the
> boundries are different. I am currently trying to figure out how to test
> this theory by using the ObjRef object returned by the
> RemotingServices.Marshall() call that I use on the server after creating
the
> first instance of the singleton object. But I am not there yet...
>
> Any comments good or bad are very welcome.
>
> Thanks,
> Gery
>
>
> --
> Gery D. Dorazio
> Development Engineer
>
> EnQue Corporation
> 1334 Queens Road
> Charlotte, NC 28207
> (704) 377-3327
>
www.enque.net > "Codemonkey" <hunter_trev@hotmail.com> wrote in message
> news:dAWdnbsLO7oQheGiU-KYuQ@fireflyuk.net...
> > Hi,
> >
> > I'm developing a distributed App using .net remoting and have been
having
> a
> > problem when trying to pass a Serializable MBV object after it has been
> > bound to controls on a windows form.
> >
> > Example:
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > <Serializable> Public Class Item
> >
> > '*************************************************
> > ' Name: Name of the item
> > '*************************************************
> > Private mName As String = ""
> > Public Event NameChanged As EventHandler
> > Public Property Name() As String
> > Get
> > Return mName
> > End Get
> > Set(ByVal Value As String)
> > mName = Value
> > RaiseEvent NameChanged(Me, New EventArgs())
> > End Set
> > End Property
> >
> > End Class
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > The above code snippet defines a simple MarshalByValue class that has a
> > "Name" Property. The property has all the extra stuff needed for
> databinding
> > (Event etc. - Please let me know if this is wrong)
> >
> > If I create an instance of this class and pass it across to a remoting
> > function call, everything works fine... the object reaches the other
side
> > without a problem.
> >
> > However, If I bind the "Name" property to a textbox on a windows form
with
> > the following code:
> >
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > txtName.DataBindings.Add("Text", mItem, "Name")
> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > The databinding works, but when I call the remoting function call as
> before,
> > the following exception is raised:
> >
> > "The type System.Windows.Forms.BindToObject in Assembly
> > System.Windows.Forms, Version=1.0.3300.0, Culture=neutral,
> > PublicKeyToken=b77a5c561934e089 is not marked as serializable."
> >
> > I could understand if "BindToObject" was a member of my "Item" class,
but
> it
> > isn't, so why is the Remoting Framework attempting to serialize it?
> >
> > Please help me with this. If you have the time, feel free to send me in
> the
> > right direction as far as databinding goes (I'm only going of an example
I
> > found somewhere before).
> >
> > Thanks in advance of any help,
> >
> > Trev.
> >
> >
> >
> >
>
>