A solar cell includes a semiconductor substrate and a sequence of semiconductor layers disposed over the substrate. The sequence of semiconductor layers includes a semiconductor window layer. The solar cell also includes a semiconductor silicon-containing cap layer over the window layer. The cap layer is spatially separated from the window layer by a semiconductor barrier layer that either includes no silicon or has a silicon concentration that is significantly lower than the silicon concentration of the cap layer.