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 :
Customer experience | Sales, Customer Insights,...
Suggested Answer

CRM 365 plugin profiler debug error

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

I have the same question (0)
  • Suggested answer
    Thangamani Profile Picture
    507 on at

    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

  • slx Profile Picture
    386 on at

    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>

  • slx Profile Picture
    386 on at

    any idea ? thanks

  • Suggested answer
    Thangamani Profile Picture
    507 on at

    Hi,

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

    Regards,

    Thangamani

  • slx Profile Picture
    386 on at

    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
    507 on at

    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
    386 on at

    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
    TigerJ Profile Picture
    115 on at

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

  • Suggested answer
    TigerJ Profile Picture
    115 on at

    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

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans