How to access ShapeID in BizTalk Orchestration

There was a question asked in MSDN BizTalk forum recently about how to access the ID of the shape/ ShapeID in BizTalk Orchestration.

When Orchestration encounters an unhandled exception, you would see ShapeID in the suspended message:

InstanceId: Instance_ID
Shape name: ThrowException_1
ShapeId: Shape_ID
Exception thrown from: segment 4, progress 3
Inner exception: Exception details.

The questioner wanted to access this ShapeID. To get the ShapeID in orchestration, add a reference to Microsoft.XLANGs.Engine assembly. This assembly is located in the installation directory of your Biztalk server. And following read-only property would get you the ShapeID.


Microsoft.XLANGs.Core.Service.RootService.ExceptionLocation.ShapeID

Though ShapeID property is part of ExceptionLocation, this property would get you the shapeID irrespective of the exception occurred or not.

ShapeID can be used in cases like logging or in custom exception handling in Orchestration. It’s also used to get the name of the shape at runtime. You might want to log the last executed shape or the shape where the failure occurred. It’s most often used to get the name of the shape with the following code:


Microsoft.XLANGs.Core.Service.RootService.FriendlyNameFromShapeId(Microsoft.XLANGs.Core.Service.RootService.ExceptionLocation.ShapeID);

Posted in: BizTalk 3 Comments December 17, 2013

About M.R.ASHWINPRABHU

M.R.ASHWINPRABHU is the founder and CEO of Fortuvis Systems Limited, a consulting company specialised in Microsoft technologies. Ashwin is a highly experienced integration consultant who works with clients to deliver high quality solutions. He works as technical lead developer, application architect and consultant, specializing in custom applications, enterprise application integration (BizTalk), Web services and Windows Azure.

Comments (3)

  • Akshay June 25, 2014 - 7:22 am Reply

    Hi Ashwin,

    Thanks for gicing this valuable info, but I am not able to find the ShapeID in ExceptionLocation, gicing Error at Design time saying that “identifier “ShapeID” does not exists in “Microsoft.XLANGs.Core.Service.RootService.ExceptionLocation”.

    I have added Microsoft.XLang.Engine.dll as reference also. I am using BizTalk Server 2009.

  • Veera January 25, 2016 - 6:58 pm Reply

    Hi Thanks for the info…And a small correction we need to refer this dll to get the shapeID
    Microsoft.XLANGs.RuntimeTypes

  • Adele July 12, 2016 - 10:10 pm Reply

    You’ve mangead a first class post

Leave a Reply

Your email address will not be published. Required fields are marked *