dotnet-api-docs
dotnet-api-docs copied to clipboard
Improve `System.FormatException` docs
Type of issue
Missing information
Description
According to the current FormatException
docs:
The exception that is thrown when the format of an argument is invalid, or when a composite format string is not well formed.
However, as described in this StackOverflow post:
FormatException
is not necessarily thrown when a formal argument of a method is invalid. It can also happen if the method is consuming an external resource and the format of the data from the external resource is inappropriate.
For example,
BinaryReader.Read7BitEncodedInt
will throwFormatException
if what it's going to read from a stream is not a valid 7-bit encoded integer. It doesn't take any arguments at all.ArgumentException
, on the other hand, should only get thrown when an argument passed as a formal parameter to a method is invalid.
The docs should be updated to clarify this. I'd be willing to try a PR if someone wants to point me to the right files.
Page URL
https://learn.microsoft.com/en-us/dotnet/api/system.formatexception?view=net-8.0&redirectedfrom=MSDN
Content source URL
https://github.com/dotnet/dotnet-api-docs/blob/main/xml/System/FormatException.xml
Document Version Independent Id
691e8234-8211-094f-f6d7-b22ed063cfc5
Article author
@dotnet-bot