Commit cb1dcde
Preserve InternString single-write invariant under DEBUG
Switching the underlying dictionaries to ConcurrentDictionary
(0a9d482) replaced Add() with TryAdd(). Add() threw on duplicate
keys, which served as a debug-time check that SetIntern is only
called once per builtin name (the invariant Initialize relies on
via its leading `Debug.Assert(_string2interns.Count == 0)`).
TryAdd silently masks that case. Capture its bool result and
Debug.Assert it - restores the same correctness signal, with no
release-build cost.1 parent 9a3dd59 commit cb1dcde
1 file changed
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
81 | 84 | | |
82 | 85 | | |
83 | 86 | | |
0 commit comments