My lenovo 11 inch Yoga laptop turns off when the charger is plugged in literally like a switch, the screen goes black, and fan stops running. I have found that i can charge my laptop if the charger is angled differently. If i plug in the charger perpendicular to the port that's when i turns off.
Computer shuts down as soon as power cord is plugged in?
Broken and shorted out connection inside that charging port. Too much sideways yanking of the power cord. Seek repair.
If that is happening then either the port is damaged and causing a short or the charger is faulty.
Either the plug or the jack, is loose or broken.
It sounds as if you have possibly have a short, so be careful. If it were a broken wire, it would just act as though the charger was not plugged in. If the laptop goes off, it means the battery was shorted out causing a total loss of power, but it also means if left that way, it could potentially burn the power supply up. Especially if your power cord is not frayed and looking good, the culprit is most likely that jack on the laptop. It could potentially be loose and twisting the cord connection could be twisting the whole internal jack causing the internal attached wires to touch and short out. The shorted condition can also burn that internal jack, making it harder to repair.