I got this compile time error today while trying to build the solution am working upon now. And this error was thrown by Exception Handling Block.
Why it happened
Upon exception, an email is sent to emailAdress which is available in the incoming message, the first message received in Orchestration (MSG_Main).
For this that particular field is marked as distinguished and it is checked, if it is blank no mail sent and if not blank then send mail.
MSG_Main.Header.EmailAddress!=""
But exception block reports it as error when compiling the solution, for it the MSG_Main is not constructed.
Its confusing as MSG_Main is received and that actually triggered the orchestration then why the error?
The reason is Exception block considers following - exception can occur anywhere within the scope, even before you receive the message, so the only thing available to exception block is the exception object from that scope(nothing else from that particular scope) and the things before the scope.
And as can be seen from image below, the First Receive shape is in scope and that's the reason for error.
What to do
In order to get rid of this I moved the receive shape out of scope and error vanished!!!
If you have questions or suggestions, feel free to do in comments section below !!!
Do share if you find this helpful .......
Knowledge Sharing is Caring !!!!!!