title: .net 4.8: The type initializer for '<Module>' threw an exception
body: <p>Our software is having an issue when invoking the Windows Workflow Foundation. What's interesting is that we only have that issue when either the client or the server is updated to .Net 4.8. When both environment are running on an older version of .Net, the application works properly. Here is what I see in the logs. The interesting part is that the application work fine when self hosted. We only get this issue when going through IIS. </p>
  
  <p>Event Viewer Details:</p>
  
  <pre><code>2019-11-17 22:43:31.8065 | Error |
  Message :Unable to find assembly 'Test.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
  Source : mscorlib
  Stack Trace :
  Server stack trace:
     at System.Runtime.Serialization.Formatters.Binary.BinaryAssemblyInfo.GetAssembly()
     at System.Runtime.Serialization.Formatters.Binary.ObjectReader.GetType(BinaryAssemblyInfo assemblyInfo, String name)
     at System.Runtime.Serialization.Formatters.Binary.ObjectMap..ctor(String objectName, String[] memberNames, BinaryTypeEnum[] binaryTypeEnumA, Object[] typeInformationA, Int32[] memberAssemIds, ObjectReader objectReader, Int32 objectId, BinaryAssemblyInfo assemblyInfo, SizedArray assemIdToAssemblyTable)
     at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
     at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
     at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
     at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
     at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
     at System.Runtime.Remoting.Channels.CrossAppDomainSerializer.DeserializeObject(MemoryStream stm)
     at System.Runtime.Remoting.Messaging.SmuggledMethodCallMessage.FixupForNewAppDomain()
     at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoDispatch(Byte[] reqStmBuff, SmuggledMethodCallMessage smuggledMcm, SmuggledMethodReturnMessage&amp; smuggledMrm)
     at System.Runtime.Remoting.Channels.CrossAppDomainSink.DoTransitionDispatchCallback(Object[] args)
  
  Exception rethrown at [0]:
     at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
     at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&amp; msgData, Int32 type)
     at System.AppDomain.get_Id()
     at &lt;CrtImplementationDetails&gt;.DoCallBackInDefaultDomain(IntPtr function, Void* cookie)
     at &lt;CrtImplementationDetails&gt;.LanguageSupport.InitializeDefaultAppDomain(LanguageSupport* )
     at &lt;CrtImplementationDetails&gt;.LanguageSupport._Initialize(LanguageSupport* )
     at &lt;CrtImplementationDetails&gt;.LanguageSupport.Initialize(LanguageSupport* )
  TargetSite : System.Reflection.Assembly GetAssembly()
  ***************************************
  Message :The C++ module failed to load while attempting to initialize the default appdomain.
  
  Source : Microsoft.VisualBasic.Activities.Compiler
  Stack Trace :    at &lt;CrtImplementationDetails&gt;.LanguageSupport.Initialize(LanguageSupport* )
     at .cctor()
  TargetSite : Void &lt;CrtImplementationDetails&gt;.LanguageSupport.Initialize(&lt;CrtImplementationDetails&gt;.LanguageSupport*)
  ***************************************
  Message :The type initializer for '&lt;Module&gt;' threw an exception.
  Source : System.Activities
  Stack Trace :    at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](LocationReferenceEnvironment environment, Boolean isLocationReference)
     at System.Activities.CodeActivity`1.OnInternalCacheMetadataExceptResult(Boolean createEmptyBindings)
     at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationReference)
     at System.Activities.Activity`1.OnInternalCacheMetadata(Boolean createEmptyBindings)
     at Microsoft.VisualBasic.Activities.VisualBasicHelper.Compile[T](String expressionText, CodeActivityPublicEnvironmentAccessor publicAccessor, Boolean isLocationExpression)
     at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1&amp; validationErrors)
     at Microsoft.VisualBasic.Activities.VisualBasicValue`1.CacheMetadata(CodeActivityMetadata metadata)
     at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity&amp; nextActivity, Stack`1&amp; activitiesRemaining, ActivityCallStack parentChain, IList`1&amp; validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
     at System.Activities.CodeActivity`1.OnInternalCacheMetadataExceptResult(Boolean createEmptyBindings)
     at System.Activities.Activity`1.OnInternalCacheMetadata(Boolean createEmptyBindings)
     at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1&amp; validationErrors)
     at System.Activities.Activity.InternalCacheMetadata(Boolean createEmptyBindings, IList`1&amp; validationErrors)
     at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1&amp; validationErrors)
     at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
     at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)
     at System.Activities.ActivityUtilities.ProcessActivity(ChildActivity childActivity, ChildActivity&amp; nextActivity, Stack`1&amp; activitiesRemaining, ActivityCallStack parentChain, IList`1&amp; validationErrors, ProcessActivityTreeOptions options, ProcessActivityCallback callback)
     at System.Activities.ActivityUtilities.ProcessActivityTreeCore(ChildActivity currentActivity, ActivityCallStack parentChain, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1&amp; validationErrors)
     at System.Activities.ActivityUtilities.CacheRootMetadata(Activity activity, LocationReferenceEnvironment hostEnvironment, ProcessActivityTreeOptions options, ProcessActivityCallback callback, IList`1&amp; validationErrors)
     at System.Activities.Hosting.WorkflowInstance.ValidateWorkflow(WorkflowInstanceExtensionManager extensionManager)
     at System.Activities.Hosting.WorkflowInstance.RegisterExtensionManager(WorkflowInstanceExtensionManager extensionManager)
     at System.Activities.WorkflowApplication.EnsureInitialized()
     at System.Activities.WorkflowApplication.RunInstance(WorkflowApplication instance)
     at System.Activities.WorkflowApplication.RunInstance(WorkflowApplication instance)
     at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)
     at System.Activities.WorkflowApplication.Invoke(Activity activity, IDictionary`2 inputs, WorkflowInstanceExtensionManager extensions, TimeSpan timeout)
     at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs, TimeSpan timeout, WorkflowInstanceExtensionManager extensions)
     at System.Activities.WorkflowInvoker.Invoke(Activity workflow, IDictionary`2 inputs)
  iis workflow-foundation
  </code></pre>