If I go to properties and try to change MCU type or anything on the fly I can't do this. I am using windows 10.
I solved the issue by deleting the "persistence data" following the instruction in the following link. https://microchipdeveloper.com/mplabx:persistence-data
In my case error reoccurs when I activate Proteus VSM addon and restart MPLAB.