Hi Jack,
Your code looks ok, and it should not have thrown you an error.
Is there any other similar process running at the time in your task manager?
In your code, did you try to initialize the Application object twice ?
If, nothing, maybe you can try to refresh the UI API reference in your project and rebuild it.
Regards
Edy