Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Error when calling a workflow - Microsoft.Crm.CrmException: System.Security.SecurityException

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

We use Microsoft Dynamics 365 version 1612 (8.2.3.114) (DB 8.2.2.2464) online.
In our instance we have setup a workflow that calls a plug-in assembly written in C#. This plug-in imports data from external system using REST API.
Recently the workflow crashes with a system error. These errors are different every time but they are in the preparation process before calling our plug-in.
The most recent error was:

System.Security.SecurityException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #805A3E11

If we try re-running the workflow, then everything works fine for some time. Next, the error appears again after the workflow has executed successfully a couple of times. Any ideas about the cause for this problem?

More details about the error:

Error Message:
Unhandled Exception: Microsoft.Crm.CrmException: System.Security.SecurityException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #805A3E11
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)
at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)

Exception Details
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Security.SecurityException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #805A3E11Detail:
<OrganizationServiceFault xmlns:i="www.w3.org/.../XMLSchema-instance" xmlns="schemas.microsoft.com/.../Contracts">
<ActivityId>c847a1e8-e3e1-4fe5-a6c4-822ae3b9f3f8</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="schemas.datacontract.org/.../System.Collections.Generic" />
<Message>System.Security.SecurityException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #805A3E11</Message>
<Timestamp>2018-11-16T16:26:06.0976984Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource>PluginExecution</ExceptionSource>
<InnerFault i:nil="true" />
<OriginalException>System.Security.SecurityException
at System.ComponentModel.Win32Exception.GetObjectData(SerializationInfo info, StreamingContext context)
at System.Runtime.Serialization.ObjectCloneHelper.GetObjectData(Object serObj, String&amp; typeName, String&amp; assemName, String[]&amp; fieldNames, Object[]&amp; fieldValues)
at Microsoft.Crm.Sandbox.SandboxAppDomainHelper.Execute(IOrganizationServiceFactory organizationServiceFactory, String customActivityTypeName, IExecutionContext requestContext, Dictionary`2 sandboxServices, Boolean useDrawbridgeEnabled, Boolean chaosFailAppDomain)
at Microsoft.Crm.Sandbox.SandboxWorker.ExecuteCustomWorkflowActivity(SandboxCallInfo callInfo, SandboxCustomActivityExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, SandboxRequestCounter&amp; workerCounter, Boolean returnTraceInfo)</OriginalException>
<TraceText i:nil="true" />
</OrganizationServiceFault>

Server stack trace:
at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Microsoft.Crm.Sandbox.ISandboxHost.ExecuteCustomWorkflowActivityAndReturnTraceInfo(SandboxCallInfo callInfo, SandboxCustomActivityExecutionContext requestContext, Guid pluginAssemblyId, Int32 sourceHash, String assemblyName, Guid pluginTypeId, String pluginTypeName, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxCustomActivity.Execute(SandboxClient client, SandboxCallTracker callTracker, IExecutionContext requestContext, String assemblyContents, Boolean returnTraceInfo)
at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error when calling a workflow - Microsoft.Crm.CrmException: System.Security.SecurityException

    The provided information is not directly related to our problem. We reviewed the articles about the plug-in isolation and the CRM limits and it doesn’t look like this is the reason for the issue. We are still unable to understand what caused that error.

    The problem hasn’t appeared for the last 5 days. We assume it is something that happens in the Dynamics environment during some preparation steps just before calling our custom code.

    However, we added some trace logging to our custom code and we hope that it will help us to understand if the problem happens while executing the workflow or before that and also it should give us some details about what exactly it throwing the exception if it happens while executing our code.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error when calling a workflow - Microsoft.Crm.CrmException: System.Security.SecurityException

    Thanks for your response!

    We will review the provided information about the plug-in isolation and we will try adding some logging to our code. If we find something, we will share it.

  • Suggested answer
    Radu Chiribelea Profile Picture
    Radu Chiribelea 6,667 on at
    RE: Error when calling a workflow - Microsoft.Crm.CrmException: System.Security.SecurityException

    Try adding some logging to the workflow. You say you are calling a REST Service. Maybe those calls take a long time to execute and times out .

    Based on the call stack, it seems to fail when executing your workflow

    at Microsoft.Crm.Sandbox.SandboxCodeUnit.Execute(IExecutionContext context)

    at Microsoft.Crm.Workflow.Services.ProxyCustomActivity.Execute(CodeActivityContext executionContext)

    Check this article: docs.microsoft.com/.../gg334752(v=crm.8) - It could explain your behavior:

    If the sandbox worker process that hosts this custom code exceeds threshold CPU, memory, or handle limits or is otherwise unresponsive, that process will be killed by the platform. At that point any currently executing plug-in or custom workflow activity in that worker process will fail with exceptions. However, the next time that the plug-in or custom workflow activity is executed it will run normally.

    You can see the CRM Online limits here: social.technet.microsoft.com/.../37177.dynamics-365-online-limitations.aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Error when calling a workflow - Microsoft.Crm.CrmException: System.Security.SecurityException

    No, we don’t use ILMerge in our project.

    The project contains many lines of source code and we are not very sure how posting it would help resolving the issue. However, I will talk with our client about sharing the source code.

  • Radu Chiribelea Profile Picture
    Radu Chiribelea 6,667 on at
    RE: Error when calling a workflow - Microsoft.Crm.CrmException: System.Security.SecurityException

    Since it is working if you try to re-run it - I wonder if this couldn't be related to the Sandbox Service executing the workflow.

    Are you using ILMerge in your project? Can you share your code?

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,969 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,842 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans