Wednesday, March 07, 2012 11:55 AM
Is it possible for an expression evaluator addin DLL to communicate with a service sited in Visual Studio and instantiated from a VSPackage? The project I'm working on uses 32-bit CRC hashes to represent strings internally, and I'm trying to write an extension that can convert the hash value to its actual string representation while debugging the project. What I'm trying to do is create a VSPackage in C# that, when loaded, creates a service that is responsible for communicating with the SQL server we use to store the hash-to-string mappings by creating a persistent connection to the server and exposing several interfaces for querying the values. Since this service remains alive once loaded, it can also contain a cache to reduce network traffic.
Once that service is set up and sited, the next step is to create an expression evaluator DLL and add an entry to the autoexp.dat file to run a function from that DLL every time one of my StringId types is encountered. Since (as far as I understand it) this DLL is loaded and unloaded each time the debugger wants to query a value it wouldn't be appropriate to try and keep persistent data in it, and creating a new network connection each time a value is queried would be prohibitively slow.
So far, so good. However, what I'm confused about is how I can get access to my persistent service from the EE DLL. The only object passed to the DLL function is one that allows me to access the debuggee process memory, and I can't see any way to get back to a Visual Studio object I can use to query my service. How can I do what I've explained above, or if it's not the right way to go about what I'm trying to accomplish, what is the right way? If it were possible to write my EE DLL in C# that would be even better, but I can just as easily write it in managed C++ (or even unmanaged C++ and interfacing with my service as if it were a COM object).
Thanks in advance!
- Edited by Dylan Barrie Wednesday, March 07, 2012 11:57 AM Fixed typo.
Saturday, March 10, 2012 9:35 PM
Unfortunately the EE DLL is not a service, hence you can not consume services in the DLL.
There are some discussions in this thread: http://social.msdn.microsoft.com/Forums/is/vsx/thread/0aaf293c-910e-4165-b9f3-32f800c61c5a
I think you can try this way:
0. Create a pipe in your package;
1. Monitor the debug events in your package;
2. Once the engine is attached, pass the pipe name to the engine;
3. Query information through the pipe in your engine.
You can check out IVsDebuggerEvents and IDebugEventCallback2 for more information.
Wednesday, March 14, 2012 3:08 AMModerator