assert Not On Ui Thread
Throws an AssertionException if the current thread is the UI thread. This is a noop in production, and is only meant to run in debug mode! If you need to check for incorrect-thread issues in production, duplicate this code and call it elsewhere.