The VS compiler or editor have never shown any tendency to remove code - except occasionally when you remove an Event handler from a control in the designer when it can remove the attached method as well.
I have never seen it remove a whole file or it's content, and am pretty sure that if anyone else had, even Microsoft would have fixed it pretty quickly.
Quote:
after 1 or 2 successful run or after I made some changes, it removes all the code
At a guess, the changes you made accidentally included removing all the code.
But we can't tell you what to do, or even that it is fixable: it may be that if you still have the same instance of VS open, and the file is still open you may be able to get it back by undoing changes until it reappears - but we have no idea what changes you made of what your code previously looked like.
Can I suggest that you should urgently review your backup procedures and in future ensure that before any major changes are made you ensure a copy of the working code is made, either automatically or manually?