Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Debug a plugin

Posted on by 516

Hi Experts,

I have more confusions in debugging a plugin in crm. First, what are all the methods to debug a plugin and how? second, which one is preferred one and why? Third, If i dont have any errors but still i want to debug my plugin. How to acheive this?
Also, whenever i try to debug my error(txt file) through plugin registration tool, i am always getting errors when i click start execution.

Thanks

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Debug a plugin

    Yes. Also along with the steps above, the plugin solution should be built and debugged under debug mode. Make sure the VS solution is not in Release mode.

  • Dhanabal Profile Picture
    Dhanabal 230 on at
    RE: Debug a plugin

    Hi Alagu Nellaikumar,

    How we do to realtime way for plugin debugging. I'm using CRM 365 online & visual studio 2012

    I couldn't find the below process in my visual studio

    a)In visual studio code, click debug->attach to process

    Asynchronous plugin

       Attach crmAsynch service

       Attach Microsoft sandbox service

       Attach w3wp service

    Synchronous Plugin

      Attach Microsoft sandbox service

      Attach w3wp service

    Regards

    Dhan

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Debug a plugin

    Hi,

    please refer the link below. Hope it will helps

    gokulkwynad.wordpress.com/.../debug-crm-online-plugin

  • Verified answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: Debug a plugin

    Hi

    Your plugin code not in that assembly.

  • AbiRami Profile Picture
    AbiRami 516 on at
    RE: Debug a plugin

    Thanks meenoo. Thanks alagunellaikumar. Here is my complete action when i tried to debug my code.

    As you said i selected my plugin step and started profiling. Then i did the action in crm which i want to debug. since i have no error i dont receive any log file to download. Then in registration tool, i started the debug process. I received a file in profile when i click the down arrow in the wizard and also uploaded my dll. Next, in visual studio i attached the process 'plugin registration tool'.
    Then In the wizard I clicked 'start Execution'.
    Here i am getting the error(popup window) which i specified earlier in this thread

    Unhandled Exception: System.InvalidOperationException: The plug-in type "MyPlugin" does not exist in the specified assembly.

  • Verified answer
    Alagunellaikumar Profile Picture
    Alagunellaikumar 6,210 on at
    RE: Debug a plugin

    Hi Abirami,

    There are two ways.

    a)Plugin registration tool

    b)Real time-

    Plugin registration tool:

    a)Start profiling your plugin

    b)Work do your action in CRM

    c)Now exception throws download error log

    d)Click debug the plugin registration tool, upload your dll and error log file

    e)Click start execution

    Real Time:

    a)In visual studio code, click debug->attach to process

    Asynchronous plugin

        Attach crmAsynch service

        Attach Microsoft sandbox service

        Attach w3wp service

    Synchronous Plugin

       Attach Microsoft sandbox service

       Attach w3wp service

    b)Work do your action in CRM

    C)Now you can debug your program

  • Suggested answer
    meenoo Profile Picture
    meenoo 7,316 on at
    RE: Debug a plugin

    Hi Abi Rami,

    I know you might have tried some of these steps already, but give it a shot through these steps.

    1. First, in the plugin registration tool, select the plugin step and you will see 'start profiling' button. Click on it.

    2. While it is profiling, perform the action that you want to debug. You will receive a profile file which you need to download and save it somewhere.

    3. Stop profiling.

    4. In visual studio, build your plugin.

    5. In plugin registration tool, hit 'debug', you will see a wizard where in you need to select the profile you downloaded and the assembly that you built in the 4th step and keep it aside(do not close).

    6. In Visual studio, you need to place a breakpoint wherever you want and then click 'Debug' in the menu options.

    7. Select 'Attach to Process' and select 'Plugin registration tool' in the available processes section.

    click ok.

    8. In the wizard(Replay Plug-in Execution) which you did in 5th step, hit 'Start Execution'.

    Your breakpoint in the plugin will be hit for you to debug.

    Try these steps and I am sure it will work.

    Thank you.

  • a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Debug a plugin

    Could you please provide step-by-step screenshots of your actions otherwise I don't see a way how to help you.

  • AbiRami Profile Picture
    AbiRami 516 on at
    RE: Debug a plugin

    Yes, I did everything. I am getting Profiles now. But when i hit start execution i am getting the error

    Unhandled Exception: System.InvalidOperationException: The plug-in type "MyPlugin" does not exist in the specified assembly.

    5707.Untitled.png

  • Suggested answer
    a33ik Profile Picture
    a33ik 84,323 Most Valuable Professional on at
    RE: Debug a plugin

    It doesn't matter if you have errors or not. Answer following questions please:

    1. Have you installed Plugin Profiler using Plugin Registration Tool?

    2. Have you enabled profiling of step you want to troubleshoot choosing "Persist to entity" option?

    3. Have you initiated action that causes triggerring of a plugin to record profile?

    4. Have you tried to click "Down Arrow" button to check available profiles with possibility to choose one of available?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

New! Quick response templatesâš¡

Save time with the new custom templates!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,232 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,064 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans