I was facing a strange runtime error when calling a BizTalk Orchestration dynamically from another Orchestration. (Dynamic Call Orchestration is not supported out of the box, so we have a custom implementation for that).
System.InvalidCastException: Unable to cast object of type ‘Microsoft.XLANGs.Core.MessageTuple’ to type ‘Microsoft.XLANGs.Core.XMessage’
Apparently, when creating Orchestration message parameters, the VS misinterprets the order of parameters. So we need to verify order and direction (In/Out/Ref) of the parameters inside Orchestration’s auto generated code & designer’s XML
body (message <Type> Rq, out message <Type> Rs)
We can correct it manually, or delete all code after #endif // __DESIGNER_DATA and reopen Orchestration and modify anything there to regenerate the code.