It's bad advice. When someone talks about their struggles and the response is "you will get through this," or similar statements like "you can do it," or "don't give up," that more often translates in a depressed person's head as "I don't think your problems are serious enough to warrant intervention or support, figure it out yourself." If someone is telling you their struggles then it's probably because they wanted to reach out in the first place. At that point I'd rather people say, "sorry I don't know how to help" because at least that's honest.
When I struggled, people telling me to "just get through this" didn't help and only made me feel like I should blame myself for my talking about it in the first place. Meanwhile, actually pursuing tangible support helped, but I could only do that myself as an adult. If only people took my problems seriously enough as a child (instead of telling me to "just get through this"), maybe I could have gotten the treatment I needed before the problem got worse. I could have avoided a lot of unnecessary suffering.