Was getting this error
xlang/s engine event log entry: Uncaught exception (see the 'inner exception' below) has suspended an instance of service 'MyProjectName.MyOrchName(8f69ac91-51ae-67be-b342-b3ee431859ca)'. 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: a38b30ab-455a-479e-8015-ac6d6960b5e9 Shape name: MyMessageAssignmentShape1 ShapeId: 426c4c2f-d3b1-4903-b4f3-648b275f899a Exception thrown from: segment 2, progress 9 Inner exception: Object reference not set to an instance of an object. Exception type: NullReferenceException Source: MyOrchName Target Site: Microsoft.XLANGs.Core.StopConditions segment2(Microsoft.XLANGs.Core.StopConditions) The following is a stack trace that identifies the location where the exception occured at MyProjectName.MyOrchName.segment2(StopConditions stopOn) at Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment s, StopConditions stopCond, Exception& exp)
I added a lot of trace/diagnostic statements and found it was blowing on this line of code, which was in a message assignment:
vXmlDocMsgToProcess = msgCanonical;
I simply added a “New” statement on XmlDocument to recreate the object/reference. Not sure 100% why it was required, but it made BizTalk happy. I seem to remember from years back when I was doing a lot of loops, that it’s often a good idea to reset your XmlDocument when in loops.
vXmlDocMsgToProcess = new System.Xml.XmlDocument(); vXmlDocMsgToProcess = msgCanonical;
This worked fine, but only for a while. When I removed some trace statement later, the exact same error came back in the exact same place.
2. The last thing I did, was to create a new variable: vXmlDocMsgToProcess2 and replaced the variable above.
So far, it is working.
I think this is a Microsoft bug, not sure if my machine has all the patches and cumulative updates on it.
3. A co-worker recommeneding doing the “new System.Xml.XmlDocument()” one time before the loop. Said it solved his similar issue.
Filed under: Orchestrations