Solar cells works roughly on this way:
The here important part is, that the photons of the Sun push the electrons out of the base plate. These electrons can find their way back only after they made some work for us.
To make this possible, that base plate should pass very strict constraints (in its crystall structure and materials what it has).
Furthermore, it depends also the energy of photons:
- Photons with too small energy (infra-red) are incapable to do anything, they are reflected back or they heat the solar cell.
- Photons with the needed energy do as we want from them.
- Photons with too much energy (they are mainly ultra-violet) can damage the base plate: they disorganize the crystall structure and the plate coating.
Obviously the solar cells on the Earth are tuned that the most solar photons fall into (2). But not all of them.
To prevent the problem of (3), typically the antireflection coating has also a filtering function, to filter out the possible most harmful photons. But this is not perfect.
The result is that the effectivity of the solar cells still decreases with time, and slowly they will become unusable. How long they last, it depends mainly on manufacturiing details, but none of them would last forever.
As the large-scale solar cell manufacturing is a young industry, there is yet not enough practical results. Different estimations around the net say some decade. Here is a detailed list of the typical degradation of the solar panels. This list is for the currently most common application, their real timeline likely significantly depends on the anti-UV coating, too.
It could be tuned, but it would require to make the antireflection/ultraviolet protection layer much more costier now. It is un-economical for the sake, to make them lasting longer decades later.