Can I run a VFD off a generator?
Two different pump salesmen have told me that running a VFD off a generator might hurt the VFD.

It's not that simple. But I can understand why the saleman says it.
It often causes problems because the VFD is too big for the generator or is misconfigured, or the only load on the generator.
This can cause severe harmonics, or instability (governor and voltage regulator) if the VFD is not running simple UF mode.
Sometimes the VFD caps blow up. Sometimes it errors mains overvoltage/undervoltage. Sometimes other components blow up. Potential for damage is high.
So, when you do this, make sure you pay attention to:

Sizing. Try to get the generator 2 times larger that the total VFD load. This is a simple rule of thumb, more specific calculations are possible taking the subtransient reactance into account. Talk to your generator supplier. Ask them for numbers.
Drive switching frequency. As high as possible considering drive derating.
Drive control algorithm. Simple V/F mode, no vector control algoritms.
Drive ramp times. No sudden speed changes, the engine is slow and can't give you instant kilowatts.
Use a braking resistor for braking, not 4-quadrant operation.

There is no cost effective filtering available to correct for a harmonics problem here. That's why the salesman just says you can't, because it could become an expensive job. Lot's of pointing fingers. I've seen it many times.
The frequencies you want to filter are 3rd to 20th harmonics, where normal mains filters work beyond the 200th harmonic.

I wouldn't even consider using a VFD on an inverter generator. Those are so small, recipe for disaster.