Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0×80131401)
If you get the error below (or something resembling the error below), you should uncheck the 32-bit only flag in your host and be sure the orchestration will be hosted by a new 64-bit instance.
xlang/s engine event log entry: Uncaught exception (see the ‘inner exception’ below) has suspended an instance of service ‘Company.CompanyDivision.BizTalk.AutoWarehouse.Orchestrations.HandleMessageFromAutoWarehouse(8a6f1226-bf81-5a66-3929-0fd9a6362777)’.The service instance will remain suspended until administratively resumed or terminated.If resumed the instance will continue from its last persisted state and may re-throw the same unexpected exception.InstanceId: 08ce066b-005f-49e4-b08e-e564e3861e1dShape name: Extract FilenameShapeId: b1727879-f428-4e57-b2b7-78310649695aException thrown from: segment 2, progress 5Inner exception: Exception has been thrown by the target of an invocation.Exception type: TargetInvocationExceptionSource: mscorlibTarget Site: System.Object _InvokeMethodFast(System.IRuntimeMethodInfo, System.Object, System.Object[], System.SignatureStruct ByRef, System.Reflection.MethodAttributes, System.RuntimeType)The following is a stack trace that identifies the location where the exception occuredat System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature 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.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)at Microsoft.XLANGs.RuntimeTypes.PartMetadata..ctor(Type t)at Microsoft.XLANGs.RuntimeTypes.PartMetadata._creator(Type t)at Microsoft.XLANGs.RuntimeTypes.MetadataCache._slowFor(Type t)at Microsoft.XLANGs.RuntimeTypes.MetadataCache.For(Type t)at Microsoft.XLANGs.RuntimeTypes.PartMetadata.For(Type t)at Microsoft.XLANGs.Core.XSDPart.SpecifyPartLevelPrefetching(Value v)at Microsoft.XLANGs.Core.Part.GenericLoadFrom(Object source)at Microsoft.XLANGs.Core.XSDPart.ProtectedLoadFrom(Object source)at Microsoft.XLANGs.Core.Part.LoadFrom(Object source)at Company.CompanyDivision.BizTalk.AutoWarehouse.Orchestrations.HandleMessageFromAutoWarehouse.segment2(StopConditions stopOn)at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)Additional error information:The type initializer for ‘Company.CompanyDivision.BizTalk.AutoWarehouse.Orchestrations.__Company_CompanyDivision_BizTalk_AutoWarehouse_Schemas_AM_ExtraProperties__’ threw an exception.Exception type: TypeInitializationExceptionSource: Company.CompanyDivision.BizTalk.AutoWarehouse.OrchestrationsTarget Site: Microsoft.XLANGs.BaseTypes.SchemaBase get_PartSchema()The following is a stack trace that identifies the location where the exception occuredat Company.CompanyDivision.BizTalk.AutoWarehouse.Orchestrations.__Company_CompanyDivision_BizTalk_AutoWarehouse_Schemas_AM_ExtraProperties__.get_PartSchema()Additional error information:Loading this assembly would produce a different grant set from other instances. (Exception from HRESULT: 0x80131401)Exception type: FileLoadExceptionSource: Company.CompanyDivision.BizTalk.AutoWarehouse.OrchestrationsTarget Site: Void .cctor()The following is a stack trace that identifies the location where the exception occuredat Company.CompanyDivision.BizTalk.AutoWarehouse.Orchestrations.__Company_CompanyDivision_BizTalk_AutoWarehouse_Schemas_AM_ExtraProperties__..cctor()
As pointed out in this post: http://www.digitaldeposit.net/saravana/post/2011/03/21/BizTalk-2010-on-Windows-2008-64bit-watch-out-for-default-installation-Challenges.aspx, the problem occurs because of the 32-bit only setting on your host.
Solution
Add or change your host instance to support 64-bit and be sure your orchestration is running inside this host instance.