While registering the AddActivity (sandbox) provided in Microsoft.Crm.Sdk.Samples using the 2011/2013/2015 SDK PluginRegistrationTool, following error is encountered and the plugin registration fails:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Exception retrieving custom activity info - Attempt by security transparent method 'Microsoft.Crm.Workflow.ObjectModel.SandboxCustomActivityLoaderDirect.GetCustomActivityInfo(Microsoft.Crm.Workflow.ObjectModel.ActivityInfo)' to access security critical type 'Microsoft.Crm.Workflow.ObjectModel.SandboxCustomActivityInfo' failed.
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<ErrorCode>-2147200995</ErrorCode>
<ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<a:key>CallStack</a:key>
<a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema"> at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.ExecuteInternal(IInProcessOrganizationServiceFactory serviceFactory, IPlatformMessageDispatcherFactory dispatcherFactory, String messageName, String requestName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, ParameterCollection fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId, Guid transactionContextId, Int32 invocationSource, Nullable`1 requestId, Version endpointVersion)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType, UserAuth userAuth, Guid targetUserId, Boolean traceRequest, OrganizationContext context, Boolean returnResponse)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.ExecuteRequest(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)</a:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>Exception retrieving custom activity info - Attempt by security transparent method 'Microsoft.Crm.Workflow.ObjectModel.SandboxCustomActivityLoaderDirect.GetCustomActivityInfo(Microsoft.Crm.Workflow.ObjectModel.ActivityInfo)' to access security critical type 'Microsoft.Crm.Workflow.ObjectModel.SandboxCustomActivityInfo' failed.</Message>
<Timestamp>2015-10-19T17:29:44.5528461Z</Timestamp>
<InnerFault>
<ErrorCode>-2147200995</ErrorCode>
<ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<a:key>CallStack</a:key>
<a:value i:type="b:string" xmlns:b="http://www.w3.org/2001/XMLSchema"> at Microsoft.Crm.Workflow.ObjectModel.CustomActivityInfoMetadataBase.GetCustomActivityInfo(ActivityInfo activityInfo, Int32 isolationMode)
at Microsoft.Crm.ObjectModel.WorkflowSandboxCustomActivityValidator.ValidateInternal()
at Microsoft.Crm.ObjectModel.PluginValidatorBase.Validate()
at Microsoft.Crm.ObjectModel.PluginTypeValidator.ValidateInternal()
at Microsoft.Crm.ObjectModel.PluginValidatorBase.Validate()
at Microsoft.Crm.ObjectModel.PluginTypeServiceInternal`1.Create(IBusinessEntity entity, ExecutionContext context)</a:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>Exception retrieving custom activity info - Attempt by security transparent method 'Microsoft.Crm.Workflow.ObjectModel.SandboxCustomActivityLoaderDirect.GetCustomActivityInfo(Microsoft.Crm.Workflow.ObjectModel.ActivityInfo)' to access security critical type 'Microsoft.Crm.Workflow.ObjectModel.SandboxCustomActivityInfo' failed.</Message>
<Timestamp>2015-10-19T17:29:44.5528461Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<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 Microsoft.Crm.Tools.Libraries.RegistrationHelper.RegisterPlugin(CrmOrganization org, CrmPlugin plugin)
at Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.btnregisterClick()