There are certainly some types of exceptions that can occur at any time without warning (a good example would be the classic StackOverflowException
).
I 'd call this particular case a documentation bug though. The documentation for NotSupportedException
does mention the System.IO
classes in general, and it also says that the HRESULT
value COR_E_NOTSUPPORTED
translates to said exception type. I 'm not sure if it's reasonable to ask that every possible error result from PInvoked code be clearly listed as a possible exception type, but that's what seems to be happening here.