locked
RegisterProjectDebugTargetProvider service is null RRS feed

  • Question

  • Hello Guys,

    I am trying to extend Debug targets menu using IVsProjectCfgDebugTargetSelection interface. Also I am trying to get RegisterProjectDebugTargetProvider service in order to register the new defined debug targets. However, the service is null when I tried to get it using GetService.

    I troubleshooted "service is null" problem. However, all the points mentioned is invalid for my case:

    • The service provided from VS, and there is no need to register it.
    • The service is requested using "SVsRegisterDebugTargetProvider" as expected.
    • VSPackage is sited before requesting the service.
    • The correct service provider is used to get the service.

    Is there any other specifications to follow in order to use RegisterProjectDebugTargetProvider service?

    Sunday, December 29, 2013 7:25 AM

Answers

  • BTW,

    What do you mean exactlt by:

    • The commands should be owned by the debug target handler package

    What is the debug target handler package?

    The content above is quoted from    IVsProjectCfgDebugTargetSelection Interface .

    Please forgive my lack of experience, since I am not familiar on this aspect, what I can do is to analyze this issue and provide some suggestions. 

    IVsRegisterProjectDebugTargetProvider provider = GetService(typeof(SVsRegisterDebugTargetProvider)) as IVsRegisterProjectDebugTargetProvider;

    According to the remarks in Package.GetService Method,to get a specific Environment SDK interface:

    1. GetService should be called with a serviceType returned by using that interface as an argument to typeof.

    2. The return value of GetService must be cast to the interface type.

    So please try to use IVsRegisterProjectDebugTargetProvider instead of SVsRegisterDebugTargetProvider in GetService method, for example:

    provider = myPackage.GetService(System.typeof(IVsRegisterProjectDebugTargetProvider)) as IVsRegisterProjectDebugTargetProvider;

    If there is any mistake in my reply, please feel free to let me know.

    Sincerely,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, December 31, 2013 5:53 AM

All replies

  • Hello,

    Welcome to MSDN Forum.

    >>I am trying to extend Debug targets menu using IVsProjectCfgDebugTargetSelection interface. Also I am trying to get RegisterProjectDebugTargetProvider service in order to register the new defined debug targets. However, the service is null when I tried to get it using GetService.

    I hope the following information could provide trivial help:

      1.  IVsProjectCfgDebugTargetSelection Interface is retrieved by a QueryInterface from the project's configuration object that implements IVsDebuggableProjectCfg.

    The definitions of new debug target type commands/icons  are made in the standard way (that is, using a .vsct file) for adding new commands for the IDE, but with the following special requirements:
    • The commands should be owned by the debug target handler package.

    • The commands should be placed in a group on the debug target menu controller.

      2.  SVsRegisterDebugTargetProvider Interface is passed to GetService to return a reference to the IVsRegisterProjectDebugTargetProvider interface.

      3.  IVsRegisterProjectDebugTargetProvider.AddDebugTargetProvider Method can add a debug target provided to the linked list of debug target providers.

    If I have any misunderstanding,please feel free to let me know and share some sample code for further analysis.

    Best Regards,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 30, 2013 7:20 AM
  • Hello Jane,

    I know all this info, thanks. My question was about getting an instance of IVsRegisterProjectDebugTargetProvider interface using GetService. I always get null from GetService call, despite following the standards of getting a service using GetService function. What could be the problem?

    Thanks

    Monday, December 30, 2013 9:24 AM
  • Hi,

    Thanks for your kind feedback.

    Have you tried to debug the application with breakpoints during call the GetService?

    For our better understanding this issue,could you please share sample code for further analysis ? 

    You can post it here or upload it on https://skydrive.live.com/ .

    Sincerely,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, December 30, 2013 9:49 AM
  • Hi Jane,

    Yes I tried to debug it, everything was fine except calling GetService which returned null. Here is how I am trying to get an instance of IVsRegisterProjectDebugTargetProvider interface in the Initialize method of ProjectPackage:

    IVsRegisterProjectDebugTargetProvider provider = GetService(typeof(SVsRegisterDebugTargetProvider)) as IVsRegisterProjectDebugTargetProvider;

    I hope that was clear,

    Thanks 

    Monday, December 30, 2013 10:00 AM
  • BTW,

    What do you mean exactlt by:

    • The commands should be owned by the debug target handler package

    What is the debug target handler package?

    Monday, December 30, 2013 3:15 PM
  • BTW,

    What do you mean exactlt by:

    • The commands should be owned by the debug target handler package

    What is the debug target handler package?

    The content above is quoted from    IVsProjectCfgDebugTargetSelection Interface .

    Please forgive my lack of experience, since I am not familiar on this aspect, what I can do is to analyze this issue and provide some suggestions. 

    IVsRegisterProjectDebugTargetProvider provider = GetService(typeof(SVsRegisterDebugTargetProvider)) as IVsRegisterProjectDebugTargetProvider;

    According to the remarks in Package.GetService Method,to get a specific Environment SDK interface:

    1. GetService should be called with a serviceType returned by using that interface as an argument to typeof.

    2. The return value of GetService must be cast to the interface type.

    So please try to use IVsRegisterProjectDebugTargetProvider instead of SVsRegisterDebugTargetProvider in GetService method, for example:

    provider = myPackage.GetService(System.typeof(IVsRegisterProjectDebugTargetProvider)) as IVsRegisterProjectDebugTargetProvider;

    If there is any mistake in my reply, please feel free to let me know.

    Sincerely,

    Jane.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, December 31, 2013 5:53 AM