microsoft/vs-validation

For 3rd party usage of this library, allow customing default exception messages to not mention Microsoft Support

drewnoakes opened this issue · 3 comments

This library is used outside of VS, for example in the Git Extensions project (which also uses JTF and vs-mef).

Currently a violation of e.g. Assumes.NotNull produces an exception with message:

An internal error occurred. Please contact Microsoft Support.

Microsoft does not provide support for Git Extensions :)

What's more, the InternalErrorException exception type is private so the library cannot easily trap these and switch them.

Good point. A cousin library that isn't Microsoft branded but otherwise is very similar uses an error message that does not mention Microsoft:

https://github.com/AArnott/Validation/blob/b30c8f449471cf75520a82ca89b39acf2f3047ad/src/Validation/Strings.resx#L142

For Git Extensions you might use that library instead. Although I suppose the other vs-threading and vs-mef libraries you're using will still bring in vs-validation and present the Microsoft support message to your users which you're trying to avoid, right? I wonder how to fix this nicely... mutable statics are a real problem all to often...

Just brainstorming here... what if we gave this vs-validation library a generic error message like its cousin has? Would that work for you?

what if we gave this vs-validation library a generic error message like its cousin has? Would that work for you?

Yes. Even if it throws a publicly exposed exception we can wrap it in another one. Tough throwing a non Microsoft-specific exception would probably be a better way forward.