Biztalk me this ... - A world apart from the everday ...

A world apart from the everday ...

Assert.IsTrue(Entries.Count == 0);

Biztalk me this ...

How do you catch a System.Exception inside an orchestration?
Before you all say this is simple, "Use an ExceptionHandler shape" read on ...
 
Here is an excellent looking article on how to do exception handling inside an orchestration ...
http://www.netologi.se/default.aspx?Contents=BizTalk_UsingOrchestrationShapes
 
Rubbing my hands in glee i rushed off to my orchestration designer and added the neccessary shapes ....
 
So now my orchestration looks similar to the following ....
 
 
As you can see, there is a scope shape with no transactions, an Expression shape (more on this in a bit) and an ExceptionHandler shape. The ExceptionHandler shape is set to catch types of System.Exception. Wicked? Yes/No? well i thought so until i ran this orchestration expecting it to hit my ExceptionHandler - but alas nudda! nothing! it's as if that shape was never there!
 
The Expression shape calls a C# helper library which uses a webservice to do some rather complex work. I moved the work into this helper library because due to various constraints (like time) I just could not get my head around trying to do this kind of logic inside an orchestration ... possible; but not if you would like sleep any time soon. At least my C# code can be debugged :D But anyways, i digress ...
 
The helper library throws Exceptions when stuff goes really pear shaped, simple;
Throw new System.Exception("Something went peared shaped!");
 
I have also have Logging inside the helper library catch block that does log to the event log, so i know the exception is being thrown. it just never gets caught inside my BizTalk orchestration.
 
In fact Biztalk goes really nuts and tries to repeat the process over and over and over and over (ok you get the idea i'm sure) again.
 


 
Why Larry, why? (Even if your name isn't Larry and you know the answer please let me know)
 
So what now?
Why does my ExceptionHandler block never get hit?
 
Surprise prize to the first person who gives me the answer to this one, but please hurry i'm losing hair faster than i'd care to imagine.
Posted: Dec 28 2005, 04:24 PM by Ryan CrawCour | with 1 comment(s)
Filed under:

Comments

NISHIL said:

Listen Larry.
If you are catching it in your helper class...then you be able to catch the exception in your exception handler shape.
If you are not catching it in your helper class then...set your exception handler to catch General Exception.
It will be caught.
Regards
NISHIL
# January 25, 2006 2:38 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Enter the numbers above: