I had this same problem with a similar Toshiba laptop. It turned out that because I over-lengthened the faulty power supply cable, there was too much electrical resistance going through the cable (and I only extended it like 1m). As soon as I removed the lengthened part of the cable and re-shortened it, the computer could charge again while being powered on. For me the problem dawned on me from physics class. I thought maybe you had the same problem because you also hard-wired it to your laptop like I did (unless this problem does not happen with other operating systems).
Alienware 17 R4 2017 review