Hi there, I have a small problem that I can't seem to find an answer too and if anyone could offer me any help it would be greatly appreciated.
My situation is this:
I have created a C#.NET Excel Addin that adds a toolbar and menus and handles their events.
I also have a C#.NET SmartTag DLL for Excel that recognises various text entered in the Excel cells.
The Excel Addin is loaded into the DefaultDomain for Excel and the SmartTag DLL is loaded into a separate AppDomain called "EasyExcelSmartTag".
Both DLLs are running on separate processes.
The Addin handles a login sequence, that when successful, populates an object called "UserData" with various user data.
I want the SmartTag DLL to access this "UserData" object in order to validate that the user has actually logged in and also to then to access the various other bits of user data.
I have tried to implement a remoting solution for this (Addin = Server, SmartTag DLL = client) however I am struggling to populate this data structure on the server.
I've tried to register the server as a client also, but this fails saying that it is already registered as a server.
Also it does seem quite crazy that for these two DLLs to share one single data object I have to create a TCP connection.
Is there a better way to do this, that allows both DLLs to access and modify the data i.e. more of a peer-to-peer instead of a client-server relationship.
Thanks,
Gareth.

Two DLLs, Two Processes, Two AppDomains - how to share data?
Rajat Solanky
megs_lefevre
Hello,
In general, the method of sharing data between two AppDomains in managed code is via Remoting [which is effectively cross-domain Marshalling].
The Windows Communication Framework (WCF, formerly codenamed "Indigo") also provides cross AppDomain communication, albeit more commonly used for web services.
The 2.0 Framework (codenamed Whidbey) version of Remoting includes a local pipe communication channel, for more efficient, non-IP-based, communication.
Win32 also supports sharing data between processes via shared memory regions, files, etc..
The most important considerations for picking a communication channel are: performance, compatibility with your existing codebase, and my personal favourite, security. Do you want your data visible to all processes All users Persisted in the file-systeme Encrypted Locked
If you can provide more data on what you are trying to accomplish in your code, we can probably provide some more specific feedback.
Hope that helps,
Stephen Fisher [Microsoft Common Language Runtime - Security: Developer]
http://blogs.msdn.com/stfisher
Sune Henriksen