lox
lox

Reputation: 1622

BizTalk scope "Catch Exception" General Exception message

I have a BizTalk (2006 R2) scope with a "Catch Exception" part in which I have put a simple Expression shape to store the exception message in an orchestration variable.

The problem is that if I choose the exception type to be "General Exception" then I do not get to supply an exception object name. Where do I retrieve exception info in this situation?

Then I thought I would just choose the exception type as System.Exception but that is not possible. I can only select more specific .NET exception types.

Am I doing it wrong or is this how BizTalk works?

Upvotes: 5

Views: 10285

Answers (5)

Mohammad Omer
Mohammad Omer

Reputation: 1

For the General Exception: In case of C#, this behaves like catch{}

You can use it when you don’t want to check exception object or Just want to re-throw exception.

System.Exception: behaves like catch(exception ex){}

All C# exceptions inherit from this exception class. It doesn’t catch all exceptions in biztalk context.

Please have a look at the screenshots for your reference.

Screenshot 1

Screenshot 2

Upvotes: 0

Robert Hasleton
Robert Hasleton

Reputation: 1

I have ran into this same issue with other selection in the properties window in an orchestration. It seems to be a bug within Visual Studios. When trying to select a .NET Assembly I get an error stating the "property is not valid". I have to close and open VS again and the message seems to go away.

Upvotes: 0

Slugart
Slugart

Reputation: 4680

The difference between the two methods is that one gives you a handle to the exception object and the other does not. You should select "General Exception" when you do not need the information contained in the Exception object. Otherwise you can select the System.Exception class from mscorlib.

Upvotes: 2

My friend you can choose exception type "System.Exception", just click assembly "mscorlib" on left panel, then click on namespace "System", in the right side will appear (alphabetically ordered) mscorlib's classes names, scroll down and you will see "System.Exception".

I hope that helps you...

Greetings

Upvotes: 1

tomasr
tomasr

Reputation: 13849

Think of catching a "Generic Exception" as the equivalent of doing a "catch { }" block in C# with no exception declared. So, yes, there's no way to get the exception message at that point because the exception that comes up might (potentially) be an object not derived from System.Exception.

I'm not sure what you mean, though, when you say that you cannot choose System.Exception as the exception type to catch. You can most certainly do that and I've done it several times in the past. Heck, just tried it again and it's there.

Are you getting any errors? Is it not appearing in the type selection dialog?

Upvotes: 8

Related Questions