Announcement

Collapse
No announcement yet.

Visual Studio debug question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Visual Studio debug question

    Hopefully one of you experenced VS guys can help me.

    I have a plugin up and running in the VS devlopment enviroment. Break points and all work and interfacing with HS fine. My question is do I have a way in VS(or just codevb.net) to trap out and see what bad calls are being made to my plugin?

    Example 1; I have a public function that takes 3 parms but some one is passing me 4.

    Example2; Someone is trying to call a public function but is using the wrong name

    Is there some sort of catch all things comming towards my object ?

    Thanks

    #2
    Originally posted by Gerard View Post
    Hopefully one of you experenced VS guys can help me.

    I have a plugin up and running in the VS devlopment enviroment. Break points and all work and interfacing with HS fine. My question is do I have a way in VS(or just codevb.net) to trap out and see what bad calls are being made to my plugin?

    Example 1; I have a public function that takes 3 parms but some one is passing me 4.

    Example2; Someone is trying to call a public function but is using the wrong name

    Is there some sort of catch all things comming towards my object ?

    Thanks
    Can't you just place a breakpoint at the beginning of your public method?

    tenholde
    tenholde

    Comment


      #3
      Originally posted by tenholde View Post
      Can't you just place a breakpoint at the beginning of your public method?

      tenholde
      ... or are you thinking that your code should catch these errors? If so a try catch block around the function should work just fine.
      💁‍♂️ Support & Customer Service 🙋‍♂️ Sales Questions 🛒 Shop HomeSeer Products

      Comment


        #4
        Originally posted by tenholde View Post
        Can't you just place a breakpoint at the beginning of your public method?

        tenholde

        tenholde
        Thats what I thought also. It did not seem to break. If that should work I'll try again. Would this be where I define the plugin Class? I am using the SDK plugin sample.

        Comment


          #5
          I'm kind of confused about what you are trying to do and what is not working as you would expect.

          You say someone is calling one of you methods with the wrong number of arguments? Who? How do you know this is happening? Is it happening while you are testing under VS? Is it a HS callback function or just a method of your plugin that users can invoke? If so, how are you invoking it during testing??

          tenholde
          tenholde

          Comment


            #6
            Originally posted by tenholde View Post
            I'm kind of confused about what you are trying to do and what is not working as you would expect.

            You say someone is calling one of you methods with the wrong number of arguments? Who? How do you know this is happening? Is it happening while you are testing under VS? Is it a HS callback function or just a method of your plugin that users can invoke? If so, how are you invoking it during testing??

            tenholde
            Sorry for the question without the details.

            I am working on a plugin that uses the MusicAPI and HST. Using the SDK API documentation I stubed out all the Music API calls with return data to understand what is called when and how to provide the correct handling to support HST music controls. I am running the plugin under VS and HST with music controls pointed towards my plugin. Most things worked, I could process Start, Stop, current track and many others.

            1) CurrentArtworkFile would not function and was never called by HST as documented in the API doc, found out thru digging into the sample ASP pages that the function name is " CurrentAlbumArtPath() ". Got me wondering what else might I be missing and how could I trap all calls made to my plugin even if I did not have a function matching the calling name.

            2) PlayMusic API call was not working either. Found out the the API doc was missing a couple of paramiters that were being passed by HST. If I set a breakpoint at PlayMusic it does not seem to trigger if there is a mismatch in the number of parameters( I have to go back and play with this as it does not make sense).

            So this is why the question and my setup. There are no Try/Catch combos in these function yet, maybe thats my problem on the mismatched par numbers but what about the function that does not exists becaues the name is wrong

            Thanks

            Comment


              #7
              Okay, that helps me understand what you are trying to do.

              I do not know of any way to catch a call to your code until it gets there. :-)


              I suspect Homeseer uses reflection to determine the available methods provided by your class. If it does not find the appropriate method, it of course does not call it. The same is true for a mis-match in parameters. I suspect Homeseer is looking for a method signature, does not find it, so skips the call.

              I do not know how to better investigate the true calling sequences from Homeseer other than what you are doing -- searching samples and documentation.

              tenholde
              tenholde

              Comment


                #8
                I suggest you do the following, which will ensure you implement the correct MusciAPIs.

                1) Import MediaCommon into your class (you will need to set a reference to this DLL) --> Imports MediaCommon
                2) Add ": Implements MediaCommon.MusicAPI" after your class which will enforce you implement the different MuciAPIs
                3) When you write your functions implementation functions specify which MusicAPI you implement. Example: Public Function LibGetGenres() As System.Array Implements MediaCommon.MusicAPI.LibGetGenres

                Of course, to debug you logic you might still need breakpoints or tracing output but at least you covered the scope required by the MusicAPIs.

                Comment


                  #9
                  Originally posted by tenholde View Post
                  Okay, that helps me understand what you are trying to do.

                  I do not know of any way to catch a call to your code until it gets there. :-)


                  I suspect Homeseer uses reflection to determine the available methods provided by your class. If it does not find the appropriate method, it of course does not call it. The same is true for a mis-match in parameters. I suspect Homeseer is looking for a method signature, does not find it, so skips the call.

                  I do not know how to better investigate the true calling sequences from Homeseer other than what you are doing -- searching samples and documentation.

                  tenholde
                  Thanks, that makes sense with what I am seeing

                  Comment


                    #10
                    Originally posted by pcp View Post
                    I suggest you do the following, which will ensure you implement the correct MusciAPIs.

                    1) Import MediaCommon into your class (you will need to set a reference to this DLL) --> Imports MediaCommon
                    2) Add ": Implements MediaCommon.MusicAPI" after your class which will enforce you implement the different MuciAPIs
                    3) When you write your functions implementation functions specify which MusicAPI you implement. Example: Public Function LibGetGenres() As System.Array Implements MediaCommon.MusicAPI.LibGetGenres

                    Of course, to debug you logic you might still need breakpoints or tracing output but at least you covered the scope required by the MusicAPIs.
                    PCP
                    I saw that MediaCommon refrenced in some code Bootsc5 shared with me but did not understand what it was. Now with it refrenced I see the objects in the browser. With the "Implements MediaCommon.MusicAPI" I see lots more work for me.

                    Thanks

                    Comment


                      #11
                      Originally posted by pcp View Post
                      I suggest you do the following, which will ensure you implement the correct MusciAPIs.

                      1) Import MediaCommon into your class (you will need to set a reference to this DLL) --> Imports MediaCommon
                      2) Add ": Implements MediaCommon.MusicAPI" after your class which will enforce you implement the different MuciAPIs
                      3) When you write your functions implementation functions specify which MusicAPI you implement. Example: Public Function LibGetGenres() As System.Array Implements MediaCommon.MusicAPI.LibGetGenres

                      Of course, to debug you logic you might still need breakpoints or tracing output but at least you covered the scope required by the MusicAPIs.
                      PCP YOU HAVE NO IDEA, HOW YOU HELPED ME WITH THIS POSTING. For the last few weeks, I've been searching on the web, rewriting methods in order to figure out why HS is not calling my musicapi.
                      After importing MediaCommon, I now see methods like PlayMusic being called. There are still some like CurrentArtWorkFile who don't seem to be called.
                      Any suggestions how/what PlayChangeNotifyCallback is supposed to do? Any vb.net examples? I though it was supposed to be an event so I was surprised it showed up as a subrouting in MediaCommon.MusicApi.
                      Thanks in advance if you see this post and can help me.
                      Dirk

                      Comment


                        #12
                        Originally posted by dcorsus View Post
                        PCP YOU HAVE NO IDEA, HOW YOU HELPED ME WITH THIS POSTING. For the last few weeks, I've been searching on the web, rewriting methods in order to figure out why HS is not calling my musicapi.
                        After importing MediaCommon, I now see methods like PlayMusic being called. There are still some like CurrentArtWorkFile who don't seem to be called.
                        Any suggestions how/what PlayChangeNotifyCallback is supposed to do? Any vb.net examples? I though it was supposed to be an event so I was surprised it showed up as a subrouting in MediaCommon.MusicApi.
                        Thanks in advance if you see this post and can help me.
                        Dirk

                        Never mind, this post by PCP explained it all
                        http://board.homeseer.com/showpost.p...2&postcount=11

                        Dirk

                        Comment

                        Working...
                        X