private static void CheckNativeAndThread (INativeDependencyObjectWrapper wrapper)
{
if (wrapper.NativeHandle == IntPtr.Zero) {
throw new Exception (
string.Format ("Uninitialized object: this object ({0}) has not set its native handle set", wrapper.GetType ().FullName));
}
if (!wrapper.CheckAccess ())
throw new UnauthorizedAccessException ("Invalid access of Moonlight from an external thread");
}