COM Interop issues from within VS.NET

J

jake.foster

All-

I have a WinForms app written in C# that's doing some COM interop with
Apple iTunes (they have a published COM API). I'm getting a reference
to the COM server and registering some event handlers that respond to
user activities in iTunes. When I run my compiled exe everything
works fine, but when I try to debug from within VS.NET, the events
never fire in my app. Here's what I've tried (with no success):

1. Disabled the "Visual Studio Hosting Process" option in the VS
project (otherwise nothing works at all)
2. Running VS.NET as administrator (no difference)
3. Running the iTunes exe as administrator (no difference)
4. Running both as administrator (no difference)
5. Writting a stub app that only does the eventing to eliminate the
possibility that it's something in my code entirely unrelated to COM
interop that's causing the problem (still no success).

I'm running the following version of VS.NET on Vista Ultimate.
Microsoft Visual Studio 2005
Version 8.0.50727.867 (vsvista.050727-8600)
Microsoft .NET Framework
Version 2.0.50727

Any ideas, suggestions or guidance on how to figure out what's going
on would be most appreciated.

Thanks!
-Jake
 
G

Guest

You don't say it, so I will ask. Are you launching iTunes.exe from the VS
debug screen where it says "Launch external program"?
 
J

jake.foster

Good question - sorry I wasn't clear about that.

My app is it's own stand-alone exe (not an iTunes plugin) so I don't
think that approach would work for me. Unless I'm missing something
it's an either/or proposition with that debug option so setting that
would launch iTunes, but not run my app. I've always used "Launch
external program" for debugging .dlls (e.g. launch NUnit as the debug
harness for my .dll project) - not for debugging .exes. If you've got
an idea for me I'm all ears.

Thanks for the quick reply!

-Jake
 
J

jake.foster

Just to clarify fully, here's how I'm trying to debug...

1. Run VS.NET & load my WinForms app project
2. Launch iTunes
3. Run my project in the VS.NET debugger

-Jake
 
G

Guest

Jake,

I would say that if you were running the two executables under the same
login on a computer, then running your winforms app under the debugger with
the same login should be identical.

I am not familiar with how event subscription accross application boundaries
works unless the com object is taking care of it somehow.

So in the case where you run the exe's side-by-side, the event triggers
something in your app, but the same event/action does not occur in your app
when your app is in the debugger, correct?
 
J

jake.foster

Mike-

"I would say that if you were running the two executables under the
same
login on a computer, then running your winforms app under the debugger
with
the same login should be identical."

That's my assumption as well.

"So in the case where you run the exe's side-by-side, the event
triggers
something in your app, but the same event/action does not occur in
your app
when your app is in the debugger, correct?"

That's exactly right. Makes for a *very* challenging situation if I
can't debug in VS.NET.

Any thoughts on what could be going on here?

Thanks!
-Jake
 
G

Guest

I am at a loss too....

Does Apple have a support forum or some such facility? I think you have it
isolated to their component.
 
J

John A Grandy

Hey Jake, this is a total shot in the dark and at the moment I'm not even on
a box with VS, but ...

Have you tried :

1. open an instance of VS and load your app
2. open a 2nd instance of VS and launch external program = iTunesv
3. in the 1st instance of VS, start your app in debug mode

I'm just trying to figure a way to make VS debugger aware of Windows
messaging from the iTunes instance ...
 
J

John A Grandy

Elaborating a little bit :

I think you'd have to write some sort of shell app in the 2nd instance that
just endlessly waits but forces pumping of messages to occur on interval
(the old DoEvents model from VB6). Then start the 2nd instance in debug
mode.

The reason I think this could work is that multiple instances of VS Debugger
are automagically aware of each other. For example, you can debug-start an
exe server in one instance, then debug-start an app that calls that exe
server in another instance and step-through or run-to-next-breakpoint will
cross process boundaries.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top