[CSHARP-529] Methods should check arguments before internal state Created: 16/Jul/12 Updated: 10/Jun/19 Resolved: 10/Jun/19 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.5 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Robert Stam | Assignee: | Unassigned |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | new-eng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Methods that check arguments should do so before checking internal state, so that internal state doesn't mask invalid arguments. For example, classes that implement the freezable pattern should check for null arguments in property setters before checking whether the instance is frozen, so that attempting to set a property to null when the object is frozen should throw an ArgumentNullException instead of an InvalidOperationException. |