Problem: After migrating a Dynamics CRM environment from 2016 OnPrem to Dynamics 365 Online I was getting the following error message every time a plugin or a custom-workflow-activity was triggered:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:
Unexpected exception from plug-in (Execute): <Plugin.Message>: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>6e625317-1f6a-46ff-8883-afaa96cb51ef</ActivityId>
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Unexpected exception from plug-in (Execute): <Plugin.Message>: System.MissingMethodException: Method not found: '!!0[] System.Array.Empty()'.</Message>
<Timestamp>2017-08-22T08:18:06.9730831Z</Timestamp>
<ExceptionRetriable>false</ExceptionRetriable>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText>
Solution: After analyzing the problem and having a look at MSDN, I found out that the plugins CWAs were compiled with .NET-Framework 4.6.1 but only 4.5.2 is supported. After changing it back to 4.5.2, compiling and deploying everything worked well.