Unable to Debug Dynamics C# Plugin in Plugin Registration Tool

前端 未结 1 1379
无人共我
无人共我 2021-01-22 19:16

Background

I have a C# plugin in Dynamics 2016 on-premise that uses a library to make calls to other systems. Part of that library is a call to dynamics using the Web

相关标签:
1条回答
  • 2021-01-22 20:09

    I remember this issue, when I was debugging SharePoint online REST API calls it will always crash. Then I added tracing service & logged checkpoints to verify the code execution path. Instead of debugging, I will download the Profiler trace log & replay in PRT to see success or failure branch.

    When you configure plugin tracing to log All under system settings, it’s Dev mode & will be super helpful.

                ITracingService tracingService = (ITracingService)serviceProvider.GetService(typeof(ITracingService));
    
                try
                {
                    tracingService.Trace("Attempting to obtain Phone value...");
                    phone = account["telephone1"].ToString();
    
                }
    
                catch(Exception error)
                {
                    tracingService.Trace("Failed to obtain Phone field. Error Details: " + error.ToString());
                    throw new InvalidPluginExecutionException("A problem has occurred. Please press OK to continue using the application.");
    
                }
    

    Reference

    In your case:

                if(responseMessage != null)
                {
    
                    tracingService.Trace("API call success & got responseMessage.");
    
                }
                else
                {
    
                    tracingService.Trace("responseMessage was empty.");
    
                }
    
    0 讨论(0)
提交回复
热议问题