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)

Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute'

(0) ShareShare
ReportReport
Posted on by 913

Hi,

I'm using a plugin which communicate with another application through legacy asmx web services. But I'm getting the following error messages.

Unhandled Exception: System.TypeLoadException: Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
   at System.ModuleHandle.ResolveType(RuntimeModule module, Int32 typeToken, IntPtr* typeInstArgs, Int32 typeInstCount, IntPtr* methodInstArgs, Int32 methodInstCount, ObjectHandleOnStack type)
   at System.ModuleHandle.ResolveTypeHandleInternal(RuntimeModule module, Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext)
   at System.Reflection.RuntimeModule.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments)
   at System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, RuntimeModule decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] attributes, IList derivedAttributes, RuntimeType& attributeType, IRuntimeMethodInfo& ctor, Boolean& ctorHasParameters, Boolean& isVarArg)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes, Boolean isDecoratedTargetSecurityTransparent)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at Microsoft.Crm.Asynchronous.V5ProxyPlugin..ctor(Type type, AsyncExecutionContext context, Boolean& isValid)
   at Microsoft.Crm.Asynchronous.EventOperation.InternalExecute(AsyncEvent asyncEvent)
   at Microsoft.Crm.Asynchronous.AsyncEventHandlerCommand`1.Execute(IAsyncEvent asyncEvent)
   at Microsoft.Crm.Asynchronous.AsyncEventExecutionManager`2.ExecuteHandler(IAsyncEventHandlerFactory handlerFactory)
   at Microsoft.Crm.Asynchronous.PoolHandler.ProcessAsyncEvent(IAsyncEventExecutionManager asyncEventExecutionManager)

I don't have this problem in QA or my local environment but exists in UAT and Production server. All servers are using .NET Framewrok 4.5.2 for CRM 2013. I don't know if it is a best practises to use web services in plugin or not. I don't get it why the plugin is looking into wrong .NET Framework(I believe it is 4.0) for ExtensionAttribute when its moved to 4.5.2.

Does anyone face the same problem?

thanks

*This post is locked for comments

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

    Using web service within the plugin is acceptable. Verify if you are using the correct SDK for your plugin build accordingly to the roll up installed on the server.

    Thanks,

    Piotr

  • Suggested answer
    Community Member Profile Picture
    on at

    Hi Litonn,

    Please refer to the below link :

    stackoverflow.com/.../could-not-load-type-system-runtime-compilerservices-extensionattribute-from-as

    Hope this helps!

    I'd appreciate if you mark this as a Verified answer.

    Thanks,

    Mohit

  • litonn Profile Picture
    913 on at

    Hi,

    thanks for the reply. Initially I was using the CRM SDK 6.1.1 from NuGet but it has dependency on .NET Framework 4.0 and 4.5. So I removed the NuGet package and using the SDK from my Development Server bin folder. All CRM environments has the same roll up and service pack and still get the same error for 19 out of 250 records.

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