Life on Earth pretty early on settled on deoxyribonucleic acid organized in chains of base pairs as the means to code for the construction of proteins which make up a lifeform. It also has the benefit that it can be biologically copied relatively simply and accurately.
But why would life that has evolved separately from Earth life end up with the same solution to the problem of coding for construction of proteins and inheritance of such coding?
The specific base pairs in DNA are cytosine ("C", C4H5N3O), guanine ("G", C5H5N5O), adenine ("A", C5H5N5) and thymine ("T", C5H6N2O2). These happen to be able to form the fairly well-known "double helix" DNA structure. Here already we can see a strong dependence on an environment rich in carbon, nitrogen and oxygen (as well as hydrogen), which works well on Earth and with Earth life.
Assuming that life develops independently (no common origin) on different planets, possibly in different solar systems, each able to support some kind of life which may be either similar to or dissimilar from Earth life, is there any plausible reason, or plausible set of criteria, why life would happen onto specifically DNA (as used by Earth life) on different planets? Or is it simply a random chance thing and there is no reason whatsoever why alien life wouldn't just as well happen onto something utterly and completely different that solves the same problem?
Please note that I am not asking about the specific proteins being coded for, or the mechanism by which DNA is used to actually drive protein production, or the need to find a solution to the problems that DNA solves in Earth life, but simply about the use of specifically DNA itself. If you want to address those issues as well, then feel free, but they are not the focus of this question.
I'm not going to tag this as hard-science, but the harder the science in the answers, the better.