COM Interop issues from within VS.NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jake.foster@gmail.com

    COM Interop issues from within VS.NET

    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

  • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

    #2
    RE: COM Interop issues from within VS.NET

    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"?

    "jake.foster@gm ail.com" wrote:
    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
    >
    >

    Comment

    • jake.foster@gmail.com

      #3
      Re: COM Interop issues from within VS.NET

      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

      Comment

      • jake.foster@gmail.com

        #4
        Re: COM Interop issues from within VS.NET

        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

        Comment

        • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

          #5
          Re: COM Interop issues from within VS.NET

          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?

          "jake.foster@gm ail.com" wrote:
          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
          >
          >

          Comment

          • jake.foster@gmail.com

            #6
            Re: COM Interop issues from within VS.NET

            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

            On Nov 2, 4:10 pm, Family Tree Mike
            <FamilyTreeM... @discussions.mi crosoft.comwrot e:
            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?
            >
            "jake.fos...@gm ail.com" wrote:
            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

            Comment

            • =?Utf-8?B?RmFtaWx5IFRyZWUgTWlrZQ==?=

              #7
              Re: COM Interop issues from within VS.NET

              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.

              "jake.foster@gm ail.com" wrote:
              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
              >
              On Nov 2, 4:10 pm, Family Tree Mike
              <FamilyTreeM... @discussions.mi crosoft.comwrot e:
              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?

              "jake.fos...@gm ail.com" wrote:
              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
              >
              >
              >

              Comment

              • jake.foster@gmail.com

                #8
                Re: COM Interop issues from within VS.NET

                Looks like that's my next line of inquiry. Thanks for the help!

                -Jake
                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.
                >
                "jake.fos...@gm ail.com" wrote:
                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
                >
                On Nov 2, 4:10 pm, Family Tree Mike
                <FamilyTreeM... @discussions.mi crosoft.comwrot e:
                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?
                >
                "jake.fos...@gm ail.com" wrote:
                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

                Comment

                • John A Grandy

                  #9
                  Re: COM Interop issues from within VS.NET

                  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 ...

                  <jake.foster@gm ail.comwrote in message
                  news:1194106459 .742402.293020@ v29g2000prd.goo glegroups.com.. .
                  Looks like that's my next line of inquiry. Thanks for the help!
                  >
                  -Jake
                  >
                  >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.
                  >>
                  >"jake.fos...@g mail.com" wrote:
                  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
                  >>
                  On Nov 2, 4:10 pm, Family Tree Mike
                  <FamilyTreeM... @discussions.mi crosoft.comwrot e:
                  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?
                  >>
                  "jake.fos...@gm ail.com" wrote:
                  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
                  >
                  >

                  Comment

                  • John A Grandy

                    #10
                    Re: COM Interop issues from within VS.NET

                    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.


                    "John A Grandy" <johnagrandy-at-yahoo-dot-comwrote in message
                    news:O%231OCZlH IHA.4560@TK2MSF TNGP03.phx.gbl. ..
                    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 ...
                    >
                    <jake.foster@gm ail.comwrote in message
                    news:1194106459 .742402.293020@ v29g2000prd.goo glegroups.com.. .
                    >Looks like that's my next line of inquiry. Thanks for the help!
                    >>
                    >-Jake
                    >>
                    >>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.
                    >>>
                    >>"jake.fos...@ gmail.com" wrote:
                    >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
                    >>>
                    >On Nov 2, 4:10 pm, Family Tree Mike
                    ><FamilyTreeM.. .@discussions.m icrosoft.comwro te:
                    >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?
                    >>>
                    >"jake.fos...@g mail.com" wrote:
                    > 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
                    >>
                    >>
                    >
                    >

                    Comment

                    Working...