D
Daylor
first of all , PLEASE,say somthing..about my post.
any reply will be nice to read.
i have vb.app , with 2 appdomains.
(now, in the next section , ill write "appdomain create" ,means a code in
the appdomain is creating )
appdomain2 call appdomain 1 to create object of type "CCar" (the param is
string )
the appdomain1 creating a object from assembly file. ( the object is ofthe appdomain1 dont know the type of this object he just created , and keep
the instance in >>Object type<<.
appdomain1 sending back >>object type<< to appdomain2. (now, as i know,
because its between appdomains , a proxy is send)
now here is the PROBLEM:
appdomain2 , get the object of >>Object Type<< ,
and want to cast it to the real object type that is >> CCar Type <<.
when appdomain 2 try to cast the >>Object Type<< to >>CCar Type << , an
exception is throw of :
A first chance exception of type 'System.InvalidCastException'
occurred in MyAssembly.dll
Additional information: Specified cast is not valid.
now here is the code sample in appdomain 2:
------------------------------
dim obj as object
dim myCar as CCar
obj = m_someObjectInAppdomain1.CreateThisClass ( "CCar")
myCar = CType(obj , CCar) // throw 'System.InvalidCastException'
------------------------------
can someone explain what im missing here ?
and how can i cast an object i recive from other appdomain ?
hope this clear.if not ,pls ask and explain any details.
im try to solve this problem for 2 day.
bye.
any reply will be nice to read.
i have vb.app , with 2 appdomains.
(now, in the next section , ill write "appdomain create" ,means a code in
the appdomain is creating )
appdomain2 call appdomain 1 to create object of type "CCar" (the param is
string )
the appdomain1 creating a object from assembly file. ( the object is ofthe appdomain1 dont know the type of this object he just created , and keep
the instance in >>Object type<<.
appdomain1 sending back >>object type<< to appdomain2. (now, as i know,
because its between appdomains , a proxy is send)
now here is the PROBLEM:
appdomain2 , get the object of >>Object Type<< ,
and want to cast it to the real object type that is >> CCar Type <<.
when appdomain 2 try to cast the >>Object Type<< to >>CCar Type << , an
exception is throw of :
A first chance exception of type 'System.InvalidCastException'
occurred in MyAssembly.dll
Additional information: Specified cast is not valid.
now here is the code sample in appdomain 2:
------------------------------
dim obj as object
dim myCar as CCar
obj = m_someObjectInAppdomain1.CreateThisClass ( "CCar")
myCar = CType(obj , CCar) // throw 'System.InvalidCastException'
------------------------------
can someone explain what im missing here ?
and how can i cast an object i recive from other appdomain ?
hope this clear.if not ,pls ask and explain any details.
im try to solve this problem for 2 day.
bye.