Sunday, May 31, 2015

Wolf he cries! Internal handled exceptions in Xamarin Forms

Edit: According to my connections to NSA, I've heard that this specific case will be reviewed to avoid throwing of an exception.

Consider the following:

<Image Source="{Binding ImageUrl}" />

ImageUrl is a string pointing to an image, like

http://www.http://www.thedomain.com/myfantasticimage.jpg

When you run this through Visual Studio with the debugger attached and break on all exceptions you get a System.InvalidCastException. The exception itself is handled internally and only visible if you break on all exceptions.

But, how is this an exception? Isn't it expected that the source might be a string? It's not an exception from the normal program flow in my opinion? Couldn't there just be a check of the type passed in and if the type is faulty, THEN throw an exception? String as a source IS valid.

Right now it's a pain to enable break on all CLR exceptions since you hit so many handled exceptions. And sometimes you need that option enabled...

It's a case of "Wolf he cries"... 

Any thoughts on this? Am I totally wrong?

1 comment:

  1. If it turned out to be smaller, then this integral is calculated by the corresponding formula and the program moves to the next right of the segment of the partition. Otherwise, the segments are declared segments of the partition and the program first refers to the calculation of the integral on the left of these segments. More info on paper writer website (Mathematics and Integrals).

    ReplyDelete