There are some people who do that, but they can succeed. I don't think it can entirely be considered wrong. There are people who have understood his abilities and they are able to pay off their debts. But I know not everyone has that expertise. You have to understand how much you are capable of, if you believe you can then it's not wrong.
But people who are in debt have an obligation to return then if they don't have the expertise to invest then it's better to pay off your debt with some of the money you can gradually.
This is a very dangerous path, if there are still debts, then the first thing you need to do is change the reasone, which led to debts (need to change mindset and habits). After that, you need to think about creating capital and investing. I read in some book, I don’t remember the name now, that there is a way to get out of debt and invest at the same time. It is necessary to agree that you will repay the debt in equal parts (possibly smaller if necessary) and at the same time you will invest part of the money of 10% of your income, and repay another 10%. I do not entirely agree with such a strategy, because the bank may not agree to extend the term of the debt, or this will lead to an increase in the amount that will have to be paid. I am a proponent that the debt should be closed as quickly as possible and then fully focused on investing.