I suspect the reason is mainly due to security concerns. Some problems with displaying / displaying text to be analyzed in the returned message are (but not limited to)
- The text to be analyzed can be very long. This will be problematic in terms of memory usage and mapping, not to mention the habits of the log developers of exception messages (not unreasonably).
- The text may contain characters that fight with formatting (for example, tab, LF, CR, etc.).
- The text may contain sensitive data. At the moment, it costs nothing that most developers, at least beginners, usually log or display error messages at the default exception level. Not including the text here means that there is no inadvertent data leak to catch the careless.
- It can be assumed (albeit unlikely) that an exploit can be found that could result in a distorted text fragment having an unpleasant unforeseen side effect.
In addition, the processed value is provided by the caller, which leaves them with the opportunity to decide whether it is better to register the content or not - this is not int.Parse() to return the value in the exception message.
In general, displaying a short message without the initially set value is a reasonable decision of the MS part in order to save us from ourselves, as well as to follow security recommendations.
source share