I have an application that uses app.previnstance to check if a copy of the program is already running. This almost always works well (and this program is used by hundreds of people every day and has been for over 15 years) but every now and then it fails and refuses to start saying it's already running even though it isn't. Whether this is because app.previnstance is wrong or it's because somehow Windows wrongly thinks it's still running I don't know.

Question 1: How exactly does app.previnstance work? What/how is it internally checking?

Question 2: Is there a "better" way of doing this? One which is guaranteed never to fail?

Thanks
Ian