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 :
Microsoft Dynamics CRM (Archived)

"Unable to load plug-in assembly" when registering plugins in CRM

(1) ShareShare
ReportReport
Posted on by 216

I've got a rather complex MS CRM plugin project which consists of a LOT of smaller DLLs (including some external references not natively available in CRM).

I usually combine all those DLLs into one using ILmerge. However, recently, this tool has become a hassle - it's slow and can lock up. As such, I wanted to move away from ILmerge and try something else. The first thing I've tried is ILrepack.

This works, and I can create a new DLL. Attempting to load the packaged DLL into the Plugin Registration Tool WORKS - the tools recognizes the package and shows the plugin classes inside.
The problem arises when I actually try to register the plugin. In this case, the operation fails, and I get the following error:

Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: Unable to load plug-in assembly.
Detail: <OrganizationServiceFault xmlns="schemas.microsoft.com/.../Contracts" xmlns:i="www.w3.org/.../XMLSchema-instance">
  <ActivityId>016ed764-1a13-4d0f-b9cd-a513efa225cd</ActivityId>
  <ErrorCode>-2147204719</ErrorCode>
  <ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic" />
  <Message>Unable to load plug-in assembly.</Message>
  <Timestamp>2017-06-18T18:13:13.4100645Z</Timestamp>
  <ExceptionSource i:nil="true" />
  <InnerFault>
    <ActivityId>016ed764-1a13-4d0f-b9cd-a513efa225cd</ActivityId>
    <ErrorCode>-2147204719</ErrorCode>
    <ErrorDetails xmlns:a="schemas.datacontract.org/.../System.Collections.Generic" />
    <Message>Unable to load plug-in assembly.</Message>
    <Timestamp>2017-06-18T18:13:13.4100645Z</Timestamp>
    <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>

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.UpdateAssembly(CrmOrganization org, String pathToAssembly, CrmPluginAssembly assembly, PluginType[] type)
   at Microsoft.Crm.Tools.AssemblyRegistration.PluginRegistrationViewModel.btnregisterClick()

Obviously, this error comes from CRM itself. However, I don't know what to do now. I suspect it's some kind of missing dependency of some sort. However, I was unable to pinpoint the issue using Fusion Logs, and I'm drawing a blank.

What can I do to debug this problem?

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at

    Can you check if you want to register a DLL with less number of classes and the one you trying to overwrite?

    e.g. DLL has 10 classes and the one you want to overwrite in CRM has 11 classes?

  • Hari Narayanan Profile Picture
    589 on at

    You need to unregister the plugin and re-register. The issue occurs when CRM cannot find a plugin that was already registered but not available in the new plugin.

    You can either remove the plugin one by one within the assembly which you have removed or you can unregister and register again.

  • MateuszBender Profile Picture
    216 on at

    That's definitely not it.

    I'm trying to register a new assembly. I never stated I was trying to update an existing DLL.

  • Hari Narayanan Profile Picture
    589 on at

    your question implies that you tried to combine the assemblies and register the same, which denotes that you were trying to update an existing DLL.

    Lets try solving the problem. can try the steps mentioned in the below url to check if any missing permissions

    Here

    Also can you provide details like CRM version and Online or on premise etc

    [View:https://community.dynamics.com/crm/f/117/t/145463:750:50]

  • MateuszBender Profile Picture
    216 on at

    The problem arises in a development environment - as such, I'm doing things as the system administrator and subsequently I have all the required permissions. So it's not a permissions issue.

    The CRM in question is the latest version of on-premise CRM 2016. I don't think it's version dependant, however.

    I've also found out the problem seems to stem from the difference in how ILrepack works (as opposed to ILmerge). Specifically, something happens when I attempt to add Microsoft.Practices.Unity.DLL as part of final assembly. If I skip this DLL, then plugin registration will work fine (obviously the code will throw an error later during plugin execution, as it'll be missing a required DLL). Like I wrote in the original post - the project consists of a number of smaller DLLs - some of which are mine and some are external (the Practices.Unity package being one of those external things).

    It might be that ILmerge adds additional assemblies as part its merge operation and ILrepack does not - but since I'd like to move away from ILmerge in favour of ILrepack, I'd still like to know why the registration is failing beyond that generic error message...

  • Hari Narayanan Profile Picture
    589 on at

    May be its good to open a discussion in the ILrepack github , since this is more of a IL re-pack dependent question. I've not used ILrepack so i'm out of option.

  • MateuszBender Profile Picture
    216 on at

    Yeah, but the merged DLL SEEMS fine. The Plugin Registration Tool can load it correctly and can correctly read the plugin classes. I can also open the DLL in Visual Studio and see the various classes and namespaces inside. It's CRM itself which throws an error during registration. Again - some details related to the error would be welcome - why exactly is it failing?

    I'd need to know SOMETHING about why it's failing before I go ask a question on the ILrepack GitHub - especially since it's unlikely people there will have access to or knowledge of MS CRM. I also suspect that knowing why CRM is failing to load the plugin will let me correct the issue as well.

  • glow_inthe_dark Profile Picture
    60 on at

    Hi MateuszBender

    same thing happen to me. Have you find way to overcome this issue?

  • Verified answer
    MateuszBender Profile Picture
    216 on at

    Unfortunately I was not able to use ILrepack and had to settle for using ILmerge in the end. I've also noticed that ILmerge will lock up if some of the DLLs you're trying to merge have references to different versions of an external DLL.

    M. Felicia:

    I assume you're having similar issues with ILrepack. If you're "just" getting the same error from CRM, then I'm afraid you should create a new topic and describe your situation as best you can, as each case related to this error can be different.

  • Prashnat Verma Profile Picture
    287 on at

    Hi,

    I am too facing the same issue with dynamics 365 on-premise. My scenario is even simpler in my dev env. I amtrying to register the plugin & i am popped out with the same error.

    How did you rectify it ?

    Thanks

    Prashant Verma

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 > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans