[C#] Little development question for the gurus out there ;-) (1 Viewer)

darkkiller

Portal Member
March 20, 2007
29
1
Hello everyone,

I have a little question:
I want to write a small plugin, alright, checked out the wiki which helped a lot and made it very easy. The plugin itself already works, but the question for me is now, how do you debug your plugin ?

Is there an easy way ?
The only solution which i see is possible is to check out the whole MP-Client-project and debug the whole mediaportal ?

Would be great to hear/read your advices ;-)

greets
Christian :D
 

arion_p

Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    Copy your plugin's debug binary and .pdb to the proper plugins directory. Then you have two options:

    1. Start MP, then in VS with you plugin's solution open, go to Debug|Attach to Process... and attach to MP's process. Then you can set break points in your code and start debugging. This is also applicable to TVServer plugins, in which case you have to attach to the tvservice process.

    2. If you need to debug startup issues, you need to go to Project Properties, in the Debug tab, under Start Action select Start External Program and select MP's executable (from your MP installation dir). Then set break points you want and run your project. VS will automatically run MP which will load your plugin, and you can start debugging.
     

    darkkiller

    Portal Member
    March 20, 2007
    29
    1
    AW: Re: [C#] Little development question for the gurus out there ;-)

    Copy your plugin's debug binary and .pdb to the proper plugins directory. Then you have two options:

    1. Start MP, then in VS with you plugin's solution open, go to Debug|Attach to Process... and attach to MP's process. Then you can set break points in your code and start debugging. This is also applicable to TVServer plugins, in which case you have to attach to the tvservice process.

    Ok i thought it would be the only way :) thanxs


    2. If you need to debug startup issues, you need to go to Project Properties, in the Debug tab, under Start Action select Start External Program and select MP's executable (from your MP installation dir). Then set break points you want and run your project. VS will automatically run MP which will load your plugin, and you can start debugging.

    That was the point i already tried, but MP needs the plugin.dll in the right directory therefore i copyed the dll with xcopy automatically after build (postbuild-event), but than VS doesnt know that this is the DLL to debug ;-)...
    How can i tell MP that it should use the output dll in /bin/debug/plugin.dll ? Does a program argument exist for that issue ?


    Thank you for your answer,... :)

    ps. are you also such a guy who is working on the 24. ? :)
    MERRY XMAS
     

    arion_p

    Retired Team Member
  • Premium Supporter
  • February 7, 2007
    3,373
    1,626
    Athens
    Home Country
    Greece Greece
    Re: AW: Re: [C#] Little development question for the gurus out there ;-)

    That was the point i already tried, but MP needs the plugin.dll in the right directory therefore i copyed the dll with xcopy automatically after build (postbuild-event), but than VS doesnt know that this is the DLL to debug ;-)...
    Did you also copy the plugin.pdb along with the dll? Even plugins in MediaPortal's solution do the same, and I know for sure that I have successfully used this method to debug plugins, though it's been some time. Then again, I may be forgetting something :(.

    How can i tell MP that it should use the output dll in /bin/debug/plugin.dll ? Does a program argument exist for that issue ?
    There is no way to tell MP to load specific plugins from other paths. MP simply enumerates the files in the corresponding plugin dir (Windows, Process, etc) and tries to load the assembly.

    I hope this helps, and a merry XMas to you too.:)
     

    darkkiller

    Portal Member
    March 20, 2007
    29
    1
    AW: [C#] Little development question for the gurus out there ;-)

    ok i say againt hank youand will give i t a try.. but i dont think it will be today :)
    Will tell you the result...


    :):):):):)
     

    darkkiller

    Portal Member
    March 20, 2007
    29
    1
    AW: [C#] Little development question for the gurus out there ;-)

    Hey it works now perfect :)
    ..if somebody else wants to make it simple & easy:

    1) In Visual Studio check the properties of the solution "Build events" --> "Post build events"
    Click on "Edit postbuild..."
    Code:
    XCopy "$(ProjectDir)bin\$(ConfigurationName)\$(ProjectName).dll"
    "C:\Program Files\Team Mediaportal\Mediaportal\Plugins\Windows" /y /r
    
    XCopy "$(ProjectDir)bin\$(ConfigurationName)\$(ProjectName).pdb"
    "C:\Program Files\Team Mediaportal\Mediaportal\Plugins\Windows" /y /r

    This will copy your Files everytime you compile to the right directory for Mediaportal

    2) In the settings click on "Debugging" and select "Start external program: " and select there the Mediaportal.exe (e.g. C:\Program Files\Team MediaPortal\MediaPortal\MediaPortal.exe)

    Close all and save it :)
    So if you press now F5 Mediaportal will popup and you can debug your project :)

    Hint:
    If you get any error message like DirectX Loader unlock blabla. or something like this, deactivate this error message by pressing
    STRG + D and then E
    and deselect "Managed Debugging Assistants" --> "LoaderLock"
     

    Users who are viewing this thread

    Top Bottom