That very much depends on what the ‘contact cleaner’ is and where you are spraying it!
The short answer is that if you have access to a quality commercial product and you know how to use it, then go for it. But, if you don’t know what/how much/how/where/why or if you think WD-40 or CRC 5.56 are the right things to spray on sensitive electronic equipment, I suggest you don’t touch it.
First, you need to understand what a contact cleaner is and how and where to use it, or you risk making things much worse. Some of the most problematic equipment I come across are pieces that have been doused in cheap contact cleaners or products that are not contact cleaners at all, like WD-40 for example.
WD-40 and CRC 5.56 are short-lifespan low-viscosity lubricants and corrosion inhibitors. They consist of a light oil suspended in volatile carriers that evaporate, leaving oily residues that protect metallic surfaces, but also attract dust and dirt. This is fine on nuts and bolts on my 4WD, but these residues foul switches and potentiometers, trapping dirt and actually making them dirtier and less reliable over time. At some point, deep cleaning will be needed to restore proper functionality. This follow-up work is time-consuming and technical.
WD-40 is not a contact cleaner, nor is it marketed as one. I’ve had people try to tell me that WD-40 is a contact cleaner because they read it in a forum. Whilst this is amusing in itself, like going to the butcher and telling them how to cut a steak, I’ve even had equipment arrive literally soaked in WD-40, something that can potentially ruin it. Please don’t do this, no matter how much you like WD-40.
But Mike, WD-40 was developed for NASA, by engineers, for use on rockets.
That’s great and maybe it was, but again, it’s not a contact cleaner or treatment. Don’t believe me? No problem, please spray a lot of it directly into your equipment. Just don’t bring it to me afterwards.