Cubase project loading: setStateInformation() is not called when number of VST Programs has changed

Hi,

my plugin has a dynamic number of programs. It parses a factory presets folder and the number of programs returned by getNumPrograms() is equal to the number of preset files.

Now I discovered a very strange behaviour in Cubase 9. I create a project with an instance of my plugin and load a program. The sound is loaded fine and I save the Cubase project. When I reload the Cubase project ,the host triggers setStateInformation() and the program is properly set. However, if I change the number of programs by removing a preset file Cubase does NOT call setStateInformation() while loading the project. I have verified with a debugger that setStateInformation() is never called as soon as the number of programs while the project was saved is different to the number of programs when the project is loaded.

Any other DAW properly calls setStateInformation() all the time.

Did anyone experience a similar issue and can recommend a solution?

Sebastian