This error occurs if the lenght of string in the method "Substring" is negative.
You can catch this exception like this:
try {
string str = App.Current.Host.Source.OriginalString.Substring(0, App.Current.Host.Source.OriginalString.IndexOf("ClientBin");
}
catch (ArgumentOutOfRangeException e) {
}
That means, check whether your string have "ClientBin" at all:
int n = App.Current.Host.Source.OriginalString.IndexOf("ClientBin");
if (n > -1)
...
or something like this ;)