Wednesday, February 1, 2012

"Assembly must be registered in isolation" error during plugin registration in a non isolation mode

Recently I faced an issue trying to register a plugin assembly in isolation mode "none". Registering it in sandbox mode was not an option as the plugin was accessing external data. The CRM setup was using IFD authentication which really should not be a factor in this case.

The plugin registration tool is available as part of the crm 2011 sdk download in the following path: sdk\tools
\pluginregistration. Once the project is built, you can use the PluginRegistration.exe application to register the assembly, step and image. MSDN has step by step walkthrough of the registration process.
When trying to register the assembly with isolation mode as null, an error message occurs.

















Selecting Yes on viewing details gives the following error detail:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk,

Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Action failed for assembly 'trakCRMPlugin,

Version=10.0.0.0, Culture=neutral, PublicKeyToken=13dfb15b5798d94b': Assembly must be registered in isolation.
Detail: <OrganizationServiceFault xmlns="http://schemas.microsoft.com/xrm/2011/Contracts"

xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
  <ErrorCode>-2147220906</ErrorCode>
  <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
  <Message>Action failed for assembly 'trakCRMPlugin, Version=10.0.0.0, Culture=neutral, PublicKeyToken=13dfb15b5798d94b':

Assembly must be registered in isolation.</Message>
  <Timestamp>2012-01-20T02:38:21.3063241Z</Timestamp>
  <InnerFault>
    <ErrorCode>-2147220906</ErrorCode>
    <ErrorDetails xmlns:a="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <Message>Action failed for assembly 'trakCRMPlugin, Version=10.0.0.0, Culture=neutral,

PublicKeyToken=13dfb15b5798d94b': Assembly must be registered in isolation.</Message>
    <Timestamp>2012-01-20T02:38:21.3063241Z</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 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
   at Microsoft.Xrm.Sdk.IOrganizationService.Create(Entity entity)
   at Microsoft.Xrm.Sdk.Client.OrganizationServiceProxy.CreateCore(Entity entity)
   at PluginRegistrationTool.RegistrationHelper.RegisterAssembly(CrmOrganization org, String pathToAssembly,

CrmPluginAssembly assembly)
   at PluginRegistrationTool.PluginRegistrationForm.btnRegister_Click(Object sender, EventArgs e)

The error message might be a generic one, so remember to view the details in orderto note the error code. In out case, the error code is -2147220906, and the error details tell us that the assembly can be registered only in isolation mode.

MSDN has an article on registering and deploying plugins that has an important restriction on the rights needed to register plugins. The following is a snippet from the link:
There is a security restriction that enables only privileged users to register plug-ins. For plug-ins that are not registered in isolation, the system user account under which the plug-in is being registered must exist in the Deployment Administrators group of Deployment Manager. Only the System Administrator user account or any user account included in the Deployment Administrators group can run Deployment Manager.

For plug-ins registered in the sandbox (isolation mode), the system user account under which the plug-in is being registered must have the System Administrator role. Membership in the Deployment Administrators group is not required.

Once the user was added to the Deployment Administrators group of Deployment Manager, you should be able to register the plugin without a problem in a non isolation mode.


























Since the error message or code really did not have the exact info on what was messing up my plugin registration, there are a couple of things that you can do to further debug it.

1. Turnning on trace will get more detailed information on what the exact issue is while running the registration tool.
2. There is this great flowchart which provides details of the possible failures and their corresponding error codes in a blog entry by Gonzalo.

1 comment: