Allowing unreachable exception

studio
p_notaproblem

#1

This a unreachable code,the studio should not allow it . I could make mistake but i think workflow should not compile.


#2

It actually isn’t, although I thought the same up to this topic:


#3

Check this example. You will see that the second catch gets fired even if the System.Exception catch is first. tryCatch.zip (2.1 KB)


#4

I have tested the attached file ,

Test the attached file .

I am trying to read a file which does not even exists .

Typically speaking this should return the IO exception rather than Exception .

My knowledge is limited so i checked with below article .

https://msdn.microsoft.com/en-us/library/system.io.ioexception(v=vs.110).aspx.

I am not able to send attachment .

STEPS:

  1. Drop a read file activity
  2. In Read file activity put the drive name as "“INMOON:\text.txt”.
  3. Add the Exception and beneth that add Msgbox with any content
    4)Add the IO Exception and beneth that add Msgbox with any content
    Test it .

For your reference :


#5

I’ve tested this myself and the exception you’re actually getting is AggregateException. This is because the Read text file activity is apparently programmed to try reading up to three times and, if it fails, throw all three exceptions as one. Because you have no specific catch clause for this exception type, it will be handled by its most direct ancestor’s clause, which is Exception in your example.