Although this is not directly related to boxing, it can break if you use a string like "1" instead of int. Two lines with the same constant value can have the same link, and therefore locking on "separate" lines will use the same synchronization block. In general, I would recommend a new object () [known good pattern] over a constant like this.
In fact, I'm not sure if boxing is for unique instances in the spec. I could, of course, see the creation of a βbox poolβ for common constants (like 0 or 1) as a possible improvement to the CLR. If it were to be implemented, this use would fail (in a very unpleasant and unpredictable way, most likely.)
source share