locked
CRM 2011 - Plugin assembly using ILMerge on Managed and Unmanaged Code RRS feed

  • Question

  • Hi,

    I am creating a Plugin assembly which is using unmanged DLL. I have used ILMerge tool to merge both assemblies into single assembly and register assemly using Plugin registration tool.

    However I get exception when plugin code gets executed as System.TypeLoadException: Bad unmanaged code entry point. Is unmanged dll supported in CRM 2011? Any help is appreciated

    >Web Service Plug-in failed in SdkMessageProcessingStepId: {612724DF-8D12-E311-94DE-005056AB01C7}; EntityName: sandisk_rma_system; Stage: 30; MessageName: Create; AssemblyName: Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
       at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: System.TypeLoadException: Bad unmanaged code entry point.

    MaKeer | myencounterwithcrm.wordpress.com | CRM2011 User Settings Utility | CRM2011 Lookup Preview | CRM2011 Lookup Attribute Mapping | CRM2011 TreeView Control (Beta) | CRM2011 N:N Entity View (Beta) | CRM 2011 Global Quick Search (Beta)

    Sunday, September 1, 2013 9:21 AM

All replies

  • The first thing to check if unmanaged code is supported in a plugin (Bitmap.LockBits is a simple way to test unmanaged code but I don't know if System.Drawing is available).
    But I think the main problem is that when you use ILMerge it will mess up the references inside the dll about the position of the compiled unmanaged code.


    My blog: www.crmanswers.net

    Sunday, September 1, 2013 9:47 AM