473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

problem to cast object im getting from diffrent appdomain

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 of
CCar type<< that inherits MarshalByRef )

the 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.
Jul 21 '05 #1
0 1366

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Daylor | last post by:
i checked again, and found my sample dont describe my real problem. the real problem is : how to create in a server and of object of type that server dont know, send it to the client. (till here...
5
by: Lucas | last post by:
Well, here's the situation.. It's pretty simple; just that I can't get it to work. I have 2 Executables.. The first one is called CSharp.exe which is a simple WinForm App. I have a single...
0
by: CowPad | last post by:
Hello All, I have a problem with serializing structs so I made a small application here to demonstrate. Hopefully someone can explain this strange problem. I have a Windows (Forms)...
1
by: Raveendra M | last post by:
Hi! I am working with ASP.NET application. In my page I am creating one Application Domain and in that domain I am calling my DLL. Using the methods of the dll. And unloading the Application...
8
by: I am Sam | last post by:
Hi everyone, This problem is making me old. I don't want to get any older. I have a multi-nested repeater control as follows: <asp:Repeater ID="clubRep1" Runat="server">...
4
by: Daylor | last post by:
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...
0
by: Daylor | last post by:
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...
39
by: Martin Jørgensen | last post by:
Hi, I'm relatively new with C-programming and even though I've read about pointers and arrays many times, it's a topic that is a little confusing to me - at least at this moment: ---- 1)...
1
by: ScriptProblem | last post by:
Hi Guys, I have a security concern with Mozilla and Netscape browsers(In IE it gives secuirity pop window) in Remote server(Client's server).When I am trying to call an Asp.NET web service from...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.