Refactor OnUIThread and AssertExtensions to external assembly.