Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Suggested answer

CRM 365 plugin profiler debug error

Posted on by 386

Hi all

I try to debug a plugin on CRM 365 online following this steps

https://dynamics365blocks.wordpress.com/2016/12/06/how-to-debug-a-plugin-in-dynamics-365-online-using-plugin-profiler/

I got this error when presssing 'start execution'

Profiler> Plug-in AppDomain Created
Profiler> Parsed Profiler File Successfully.
Profiler> Constructor Execution Started: 10/30/2019 17:12:18
Profiler> Constructor Execution Failed due to an Exception (Duration = 44ms).
Profiler> Profiler Execution Completed with an Unexcepted Exception Type (Duration = 0ms): System.Reflection.TargetInvocationException.
Profiler> Profiler AppDomain Unloaded

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Inheritance security rules violated while overriding member: 'Microsoft.Xrm.Sdk.InvalidPluginExecutionException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.
Detail: <OrganizationServiceFault xmlns="">schemas.microsoft.com/.../Contracts" xmlns:i="">www.w3.org/.../XMLSchema-instance">
  <ActivityId>00000000-0000-0000-0000-000000000000</ActivityId>
  <ErrorCode>-2147220970</ErrorCode>
  <ErrorDetails xmlns:a="">schemas.datacontract.org/.../System.Collections.Generic">
    <KeyValuePairOfstringanyType>
      <a:key>CallStack</a:key>
      <a:value i:type="b:string" xmlns:b="">www.w3.org/.../XMLSchema">   at XXXXXXX.Plugin.PostNoteCreate..ctor(String unsecure, String secure)</a:value>
    </KeyValuePairOfstringanyType>
  </ErrorDetails>
  <HelpLink i:nil="true" />
  <Message>Inheritance security rules violated while overriding member: 'Microsoft.Xrm.Sdk.InvalidPluginExecutionException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.</Message>
  <Timestamp>2019-10-30T17:16:19.4860974Z</Timestamp>
  <ExceptionRetriable>false</ExceptionRetriable>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>00000000-0000-0000-0000-000000000000</ActivityId>
    <ErrorCode>0</ErrorCode>
    <ErrorDetails xmlns:a="">schemas.datacontract.org/.../System.Collections.Generic" />
    <HelpLink i:nil="true" />
    <Message i:nil="true" />
    <Timestamp>0001-01-01T00:00:00</Timestamp>
    <ExceptionRetriable>false</ExceptionRetriable>
    <ExceptionSource i:nil="true" />
    <InnerFault i:nil="true" />
    <OriginalException i:nil="true" />
    <TraceText i:nil="true" />
  </InnerFault>
  <OriginalException i:nil="true" />
  <TraceText i:nil="true" />
</OrganizationServiceFault>

  • Suggested answer
    TigerJ Profile Picture
    TigerJ 115 on at
    RE: CRM 365 plugin profiler debug error

    You may have your project configured to build for release instead of debug.

    Check your project settings in visual studio.

    See this document for details on configuring visual studio build settings:

    docs.microsoft.com/.../how-to-set-debug-and-release-configurations

  • Suggested answer
    TigerJ Profile Picture
    TigerJ 115 on at
    RE: CRM 365 plugin profiler debug error

    You may have your project configured to build for release instead of debug. Check your project settings in visual studio.

  • slx Profile Picture
    slx 386 on at
    RE: CRM 365 plugin profiler debug error

    thank you, there is already a class Plugin in prj that extends IPlugin

       /// <summary>

       /// Base class for all Plugins.

       /// </summary>    

       public class Plugin : IPlugin

       {

           protected class LocalPluginContext

           {

               internal IServiceProvider ServiceProvider

               {

                   get;

                   private set;

               }

  • Suggested answer
    Thangamani Profile Picture
    Thangamani 507 on at
    RE: CRM 365 plugin profiler debug error

    Hi,

    Pls change the class from   public class PostOrganisationCreate : Plugin

      {

    }

    TO

     public class PostOrganisationCreate : IPlugin

      {

    }

    In your code is IPlugin is missing ,add Iplugin instead of plugin.

    Hope this helps.

    Regards,

    Thangamani

  • slx Profile Picture
    slx 386 on at
    RE: CRM 365 plugin profiler debug error

    namespace XXXXX.Plugin

    {

       using System;

       using System.ServiceModel;

       using System.Web;

       /// <summary>

       /// PostOrganisationCreate Plugin.

       /// </summary>    

       public class PostOrganisationCreate : Plugin

       {

           /// <summary>

           /// Initializes a new instance of the <see cref="PostOrganisationCreate"/> class.

           /// </summary>

    +++++

    This is debugged, no error under profiler - I can go up to the end of this function, getting value with throw any error

    ++++

           public PostOrganisationCreate(string unsecure, string secure)

               : base(typeof(PostOrganisationCreate))

           {

               base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, "Create", "account", new Action<LocalPluginContext>(ExecutePostOrganisationCreate)));

               // Read in the relevant secure config parameters

               if (!String.IsNullOrWhiteSpace(secure))

               {

    ///////////////

               }

               else

               {

                   throw new InvalidPluginExecutionException(OperationStatus.Failed, "Secure strings are required but not provided.");                

               }

           }

    +++++

    Profiler return error here - debug breakpoint disappears, getting error with invalid security from initial message

    Next function doesn't picked up in debug

    +++++

           /// <summary>

           /// Executes the plug-in.

           /// </summary>

           protected void ExecutePostOrganisationCreate(LocalPluginContext localContext)

           {

               if (localContext == null)

               {

                   throw new ArgumentNullException("localContext");

               }

    xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

  • Suggested answer
    Thangamani Profile Picture
    Thangamani 507 on at
    RE: CRM 365 plugin profiler debug error

    Hi,

       Is it possible to paste your code here to have a look?

    Regards,

    Thangamani

  • slx Profile Picture
    slx 386 on at
    RE: CRM 365 plugin profiler debug error

    any idea ? thanks

  • slx Profile Picture
    slx 386 on at
    RE: CRM 365 plugin profiler debug error

    Thank you for reply, the code is running in production with no issues, it is CRM 365 online registered sandbox

    yes, there is unsecured configuration passed

    Constructor looks like this :

           public PostOrganisationCreate(string unsecure, string secure)

               : base(typeof(PostOrganisationCreate))

           {

               base.RegisteredEvents.Add(new Tuple<int, string, string, Action<LocalPluginContext>>(40, "Create", "account", new Action<LocalPluginContext>(ExecutePostOrganisationCreate)));

    #######

           protected void ExecutePostOrganisationCreate(LocalPluginContext localContext)

           {

    ####

    If I executed the debug profiler as Isolation = Sandbox I get error straight away

     <Message>Inheritance security rules violated while overriding member: 'Microsoft.Xrm.Sdk.InvalidPluginExecutionException.GetObjectData(System.Runtime.Serialization.SerializationInfo, System.Runtime.Serialization.StreamingContext)'. Security accessibility of the overriding method must match the security accessibility of the method being overriden.</Message>
     

    If I executed the debug profiler as Isolation = None it failed at ExecutePostOrgCreate

      <Message>Unable to cast object of type xxxxxxPostOrgCreate' to type 'Microsoft.Xrm.Sdk.IPlugin'.</Message>

  • Suggested answer
    Thangamani Profile Picture
    Thangamani 507 on at
    RE: CRM 365 plugin profiler debug error

    Hi,

      I think your constructor class is having an issue and pls correct it as per the plugin set up.Did you try to pass any unsecure configuration?

    Pls check it.

    Regards,

    Thangamani

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!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans