To be fair, they usually have a
warrantied lifespan of 25 years... and as solar cells start degrading, their output drops off in a gradual linear fashion.
At 25 years, solar panels still produce between 80% and 87% of their manufactured capacity. At 50 years, they should still produce between 60% and 75% of their manufactured capacity.
It's quite possible that solar panels could have much longer life spans. There isn't a lot of data yet, but there are some indications that they'll be performing well.
A 33W solar panel (Arco Solar 16-2000) actually outperformed it’s original factory specifications 30 years after it was manufactured
World`s first modern solar panel still works after 60 years
Kyocera has reported several solar power installations that continue to operate reliably and generate electricity even though they are nearly 30 years old
The big problems in longevity at the moment are batteries and inverters that typically have to be replaced every 5 to 10 years.
When I build my off-grid solar system, I'm planning to use NiFi batteries (Nickel Iron) that have lifespans in the hundreds of years with minimal maintenance. They're larger and hold less capacity, but don't damage themselves when over/under charged and use materials a lot more available than modern high-density battery storage technologies.
I haven't seen a long-life inverter yet and that's frustrating. Inverter manufacturers have thin margins and competition, so they focus on lowering costs rather than redundancy and hardening.