I've been having an error lately that looks like this in the event log:
Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'SomeRoutines.OrderHandler(1f254f9a-5838-1051-30a3-ca1c40b2906f)'.
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: 875947d5-5c01-4ad7-9d62-a033902a3133
Shape name: ConstructUpdateMessage
ShapeId: 43a0909e-5877-4e6e-a6a0-c4bbb7c5c644
Exception thrown from: segment 1, progress 12
Inner exception: Error encountered while executing the transform SomeRoutines.SomeTransformation. Error:Unable to create the transform..
Exception type: XTransformationFailureException
Source: Microsoft.XLANGs.Engine
Target Site: Void ApplyTransform(System.Type, System.Object[], System.Object[])
The following is a stack trace that identifies the location where the exception occured
at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
at SomeRoutines.OrderHandler.segment1(StopConditions stopOn)
at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
Additional error information:
Could not load file or assembly 'Xxxxxxxxxxx.XxxXxxxxx.Integration.HelperFunctions, Version=1.0.0.1, Culture=neutral, PublicKeyToken=aaaaabbbbbccccdddd'
or one of its dependencies. The system cannot find the file specified.
Exception type: FileNotFoundException
Source: mscorlib
Target Site: System.Reflection.Assembly nLoad(System.Reflection.AssemblyName, System.String, System.Security.Policy.Evidence, System.Reflection.Assembly,
System.Threading.StackCrawlMark ByRef, Boolean, Boolean)
The following is a stack trace that identifies the location where the exception occured
at System.Reflection.Assembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, Assembly locationHint, StackCrawlMark& stackMark,
Boolean throwOnFileNotFound, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
at System.Reflection.Assembly.Load(String assemblyString)
at Microsoft.XLANGs.BaseTypes.TransformBase.get_TransformArgs()
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData..ctor(Type transformBaseType)
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData._creator(Type t)
at Microsoft.XLANGs.RuntimeTypes.MetadataCache._slowFor(Type t)
at Microsoft.XLANGs.RuntimeTypes.MetadataCache.For(Type t)
at Microsoft.XLANGs.RuntimeTypes.TransformMetaData.For(Type t)
at Microsoft.XLANGs.Core.Service.ApplyTransform(Type mapRef, Object[] outParams, Object[] inParams)
The problem with this was that the .dll version number had been increased from 1.0.0.1 to 2.0.0.0, causing the above error. I had recompiled the project in question and deployed it again, but I still got this error and today I decided to take a look at its cause. It turned out that what I have in the .btm file (BizTalk map) is a scripting function, calling an
external assembly. Now, when you do that, this is what it looks like in the .btm file:
<ScripterCode>
<Script Language="ExternalAssembly" Assembly="Xxxxxxxxxxxx.Xxxxxxx.Integration.HelperFunctions, Version=1.0.0.1, Culture=neutral, PublicKeyToken=aaaabbbbbbcccccdddd"
Class="Xxxxxxxx.Xxxxxxxxxxx.Integration.HelperFunctions.WrapperClass" Function="GetDiscount"
AssemblyPath="..\IntegrationFunctoids\obj\Debug\Xxxxxxxxxxxx.Xxxxxxxxx.Integration.HelperFunctions.dll" />
</ScripterCode>
What this means in reality is that the binding is not done using the project's "assembly references"; rather, the .dll is loaded at runtime. Sure, that's a pretty convenient thing at times. Right now in this case though, it would have been better to have the .dll files be more "statically" bound to each other.
The problem with dynamic binding (or "dynamic references" might be a better phrase) is that you don't get the errors when you want them: at compile time. Rather, you get it at run time.
However: what you
do get is that you get the error when you try the "Test Map" function in Visual Studio. Once again, clearly, this nice function can not be over-emphasized. :-)