Skip to content

Port ThrowHelper to its own library

Of all the code in CommonCore, the two pieces I most commonly find myself needing are the IsEmpty(string) extension method and the ThrowHelper. The former is easy enough to work without and simple enough to reimplement otherwise. ThrowHelper on the other hand is too complex to reimplement and working without it tends toward less argument validation and thus less stable code.

The other CommonCore libraries are a good example. As a guideline, the other libraries should avoid depending on the CommonCore library itself unless they make extensive use of its features. Referencing it only for ThrowHelper seems like overkill.

To address this problem, I'm proposing that ThrowHelper be removed from CommonCore and put into its own library project, CommonCore.Exceptions.

Obviously this would be a breaking change. CommonCore itself would also then gain a dependency on CommonCore.Exceptions, which seems a bit inverted, but is not a deal breaker.