2

Often methods in VB.Net throw exceptions. How can I write the code or documentary comments to allow possible exception throws to pop-up when the method is used in code? (Like the way a method's summary pops up.)

The point is to show the testers or other users of the method what exception(s) to expect.

4
  • What do you mean? Yes, you can throw exceptions using the command Throw New Exception(Message). Commented Feb 4, 2014 at 12:56
  • As I read in C# there is a way to document an exception that custom method throws /// <summary>the method's summary</summary> /// <exception cref="ArgumentNullException">some comment</exception> But I am afraid that does not work in vb. Commented Feb 4, 2014 at 13:04
  • Can you post the C# code? have you tried the C# to VB converters that are online? e.g. converter.telerik.com Commented Feb 4, 2014 at 14:00
  • Thanks, Mych. I tried [link](C# XML documentation) As I mentioned it is weird but it seems exception tags doesn't work for VB.Net Commented Feb 4, 2014 at 14:12

1 Answer 1

3

You can use the <exception> tag in the XML documentation of a method.

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

2 Comments

Thanks, @Dominic Kexel, but I am afraid I tried the XML documentation and the exception doesn't pop-up. Trying the same in C# results in showing the exception below the summary in a pop-up when method is used in code. But in VB only summary is showed but not and the exceptions thrown.
Sorry, but Intellisence in VB.Net won't show you the exceptions like it does in C#. But you should still use the <exception> tag since the Object Browser does read this tag and show you the exceptions; so this information is just one keypress away.

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.