Why does cubase lose the Midi controller port setup at each new start.?

Here are two workarounds that might work. However, they are just workarounds.
Workaround 1:
Make a backup of the working MIDI Remote and use the backup if Cubase corrupts the assignments or the script. This will always happen when a corrupted project is loaded or when you delete the greyed-out duplicates.
This behaviour in old projects has not been resolved, not even in the new versions, because Steinberg does not understand this bug, even though it could be fixed. This bug has existed for years and has been confirmed by a great many users. However, Steinberg does not seem to be reading these posts, even though they say they do. They probably don’t test with old projects either, but always use the latest versions. As a result, however, they cannot understand this bug.

Workaround 2:
The ‘Save as’ method.

I’ve given up by now and use these workarounds. It’s very time-consuming, especially if you still have older projects.
It could be resolved if Steinberg were to include a function to gently delete duplicates without corrupting the MIDI ports.
Furthermore, the assignments shouldn’t be changed on the fly in the Globalmappings file. This causes errors that then affect other projects as well.
I think it was a mistake to allow the MIDI Remote to be used both globally and on a project-by-project basis, and for the MIDI Remote settings to be saved within the project file as well.