web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Debug a plugin

(0) ShareShare
ReportReport
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

I have the same question (0)
  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    Hello,

    So there are 2 methods to debug - indirect and direct - indirect using logs that are not always the best source for troubleshooting and direct - using debugger and visual studio. My suggestion - use second.

    To troubleshoot plugin without dependency on environment (Online, On-Prem, On-Prem with IFD) and type of plugin registration (with or without isolation) you should use Plugin Registration tool and Visual Studio.

    Following video demonstrates how to troubleshoot your plugin in the most efficient way - www.youtube.com/watch

    Good luck.

  • AbiRami Profile Picture
    516 on at

    Thanks Andrii. When i dont have any errors in my plugin, can i able to debug in the way the video explained. Because i dont see anything when i try to select profile.

    7273682.Capture.PNG

  • Suggested answer
    a33ik Profile Picture
    84,331 Most Valuable Professional on at

    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?

  • AbiRami Profile Picture
    516 on at

    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

  • a33ik Profile Picture
    84,331 Most Valuable Professional on at

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

  • Suggested answer
    meenoo Profile Picture
    7,316 on at

    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.

  • Verified answer
    Alagunellaikumar Profile Picture
    6,212 on at

    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

  • AbiRami Profile Picture
    516 on at

    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
    6,212 on at

    Hi

    Your plugin code not in that assembly.

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi,

    please refer the link below. Hope it will helps

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

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans