Sounds like there is an electrical problem connecting to the gear select lever, an open circuit.P1717 Gear Lever Signal Fault (CAN 250) Open Circuit
It could be a faulty connector on the wring loom that connects to the gear selector, or the selector itself.
this is the gear selector on ebay. There are several ways to test, but an inspection helps find wiring and connection problems, then swap parts and test by substitution or send parts off to be tested or tried on another car.