Mike,

I get an InvalidCastException:

System.InvalidCastException: Return argument has an invalid type.
   at System.Runtime.Remoting.Proxies.RealProxy.ValidateReturnArg(Object
arg, Type paramType)
   at
System.Runtime.Remoting.Proxies.RealProxy.PropagateOutParameters(IMessag
e msg, Object[] outArgs, Object returnValue)
   at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg)
   at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type)
   at Xception.Midas.DataAccess.Generated.ClassFactory.NewInstance()
   at Xception.Midas.DataAccess.Generated.ClassFactory.CreateInstance()
in C:\Documents and Settings\deanc\My Documents\Visual Studio
2005\Projects\Xception\Midas\DataAccess\Generated\ClassFactory.cs:line
1311

But I don't get that error from the first AppDomain.

There is a possibility that the files are loading from 2 different
locations (the Outlook Addin loads from the Addin project Release
folder, whereas the COM control loads from the UI projects Release
folder - if that makes a difference?). They are both compiled in the
same solution though.

Dino

-----Original Message-----
From: Discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Mike Woodring
Sent: Saturday, 14 October 2006 13:08
To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM
Subject: Re: [ADVANCED-DOTNET] Get an AppDomain you didn't create

> I have code in 2 AppDomains that need to call the same code on the 
> same remote server. The actual code in each AppDomain is identical (2 
> copies of the same assemblies) however the second one always fails. I 
> have found some references from other people indicating this is a 
> known issue, but it's hard to find because 99% of references to 2 
> AppDomains pertain to calling between them, not both calling the same
server.
>
> .Net 2.0

That's odd, because it works for me.  Before I posted the code I did,
I'd scratched out a simple app that setup 2 appdomains, both of which
connected to the same remote server.  Then I read the email trail a bit
closer and got the impression you were just trying to talk from one app
domain to another.

I'm not near that code at the moment, but if you email me offlist I can
send it your way.  Alternatively, maybe include the actual exception
details you're seeing?

-Mike
http://www.bearcanyon.com
http://www.pluralsight.com/mike

===================================
This list is hosted by DevelopMentor(r)  http://www.develop.com

View archives and manage your subscription(s) at
http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to