Unable to Debug Dynamics C# Plugin in Plugin Registration Tool

▼魔方 西西 提交于 2019-12-02 02:17:10

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.");

            }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!