无法在插件注册工具中调试Dynamics C#插件 [英] Unable to Debug Dynamics C# Plugin in Plugin Registration Tool

查看:151
本文介绍了无法在插件注册工具中调试Dynamics C#插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在内部Dynamics 2016中有一个C#插件,该插件使用一个库来调用其他系统.该库的一部分是使用Web API进行的动力学调用.我可以看到动态变化,因此该插件正在采取措施,但是我希望它采取的措施与正在采取的措施有所不同.当我尝试使用插件注册工具调试插件时,遇到了一些问题.当我使用Exception方法对插件进行概要分析时,会得到一个异常文件,可以调试到某个位置.当我到达以下代码时,插件注册工具崩溃,没有错误消息.当我使用Persist to Entity方法进行调试时,我的插件似乎成功了,但是在插件注册工具中未记录任何配置文件.我的插件是从与工作流程完成相关的工作流程触发的操作中触发的(此操作基于此处,导致了这个问题.关于让调试器与我的代码一起使用的任何想法?

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 API. The Plugin is taking action as I can see the changes in dynamics, however I am expecting it to take a different action than it is taking. When I try to debug the plugin using the Plugin Registration tool, I am running into some issues. When I profile the plugin using the Exception method, I get an exception file that I am able to debug through to a point. When I get to the below code, the Plugin Registration Tool crashes without an error message. When I debug using the Persist to Entity Method, my plugin appears to succeed, but no Profiles are logged in the Plugin Registration Tool. My plugin is fired from an action which is triggered from a workflow that is attached to the completion of a Business Process Flow (this is based on this article). My initial question is here which led to this question. Any thoughts on getting the debugger to work with my code?

HttpClient client = new HttpClient(new HttpClientHandler() { Credentials = new NetworkCredential("admin", "password", "DOMAIN") });
client.BaseAddress = new Uri(Helpers.GetSystemUrl(COHEN.APIConnector.Application.Dynamics));
client.DefaultRequestHeaders.Clear();
client.DefaultRequestHeaders.Accept.Add(new System.Net.Http.Headers.MediaTypeWithQualityHeaderValue("application/json"));
client.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0");
client.DefaultRequestHeaders.Add("OData-Version", "4.0");
HttpResponseMessage responseMessage;
string url = "ccseq_clients";

responseMessage = client.GetAsync(url).Result;

推荐答案

我记得这个问题,当我调试SharePoint在线REST API调用时,它将始终崩溃.然后,我添加了跟踪服务&记录检查点以验证代码执行路径.无需调试,我将下载Profiler跟踪日志&在PRT中重播以查看成功或失败分支.

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

            }

在您的情况下:

            if(responseMessage != null)
            {

                tracingService.Trace("API call success & got responseMessage.");

            }
            else
            {

                tracingService.Trace("responseMessage was empty.");

            }

这篇关于无法在插件注册工具中调试Dynamics C#插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆