Like others said, running the motor isn't a problem while connected to shore power. Warming up the motor is a good idea too, within reason to warm the motor, but it's not very efficient to heat your cabin space.
Presumably if you're connected to shore power, you should have your electric space heater running. If you don't have an
electric space heater, it might be a good idea to consider one if camping in the cold at lot. It's the cheapest way to heat your RV, if you have hookups.
Generally speaking, using the engine to heat up cabin space isn't advised while stationary, from a cost point of view, but it's good practice to start the motor for 5min to get the motor warm for a trip.
After I have stowed away all objects inside for travel, I start the motor to pull in the slides and raise the jacks. Then while the motor is running, I walk around the rig checking all compartment doors, then stow the electric cord, and hoses if any are out. Sometimes I have to put the bicycles on the rack too. By the time I get back in the RV, the motor is warm and ready to drive, and off we go.
If we need more heat, beyond what the engine can put out in the beginning, I'll set my electric heater on low (750W) running off the inverter for 10 or 15min until the motor can maximize the heat, which eventually heats up good enough. With really cold climates like you mention, a 12V electric blanket for my wife helps mitigate a cold windshield cooling things down. She just drapes the blanket over her legs, sometimes over her shoulders if she's chilled. Eventually the defroster will warm the windshield and enough heat will be produced by the motor while you drive.