I have this particular situation, where I started one thesis during my master's about X topic (which I love). I was asked to wait around 4 months while the base code was ready to work, but when the time arrived, the program was buggy and poorly coded. However, I studied all the theoretical background that they coded, and then debugged the software for around 3 months, but in the end, it never worked.
This professor was very helpful while I was debugging it, but when I decided not to continue with the project as it looked like the debugging was never going to end, he became angry and behaved as if the project failure was my fault... I was the one who should've been pissed off after more than half a year wasted in that project...
In any case, I graduated with another thesis and now I am looking for a PhD, in that X topic... I found a very interesting one very related to the thesis I was doing before, and I would like to include in the motivation letter, my background and the experience I got while I was debugging (in fact I learned more about the topic while debugging, than reading the theory).
What would be the best way to mention this project without backfiring at me, or being asked for a reference from that professor who will definitely not recommend me?