0

Any idea how Uri.EscapeDataString() can throw a System.UriFormatException but it does not appear to be possible to catch it explicitly?

If I try to catch it explicitly I just get "type or namespace name 'UriFormatException' does not exist in the namespace 'System'"

1
  • Can you add the string which have problems?, potion of code? Did you add the namespace? .. try catch(System.UriFormatException ex) ... Commented Sep 25, 2012 at 15:45

1 Answer 1

3

According to Uri constructor help in MSDN:

In the .NET for Windows Store apps or the Portable Class Library, catch the base class exception, FormatException, instead.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks that's what I ended up doing. I just expected a better option. I'm surprised that's what they recommend.
I am speculating but I think the UriException did not offer anything new over the FormatException with this kind of app.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.