Skip to content
This repository has been archived by the owner on May 15, 2024. It is now read-only.

Properly check for thread access on UWP #332

Merged
merged 2 commits into from
Jun 26, 2018
Merged

Conversation

mattleibow
Copy link
Contributor

Description of Change

Fix the logic that determines whether or not on the UI thread.

Bugs Fixed

None.

API Changes

None.

Behavioral Changes

Previously, the check was CoreApplication.MainView.CoreWindow.Dispatcher == null for background threads, but this is incorrect. The window will always have a thread since it was created on a thread at some point. To check if the thread is the UI thread (or if the current thread is the same as the thread as the window), use the HasThreadAccess property.

PR Checklist

  • Has tests (if omitted, state reason in description)
  • Has samples (if omitted, state reason in description)
  • Rebased on top of master at time of PR
  • Changes adhere to coding standard
  • Updated documentation (see walkthrough)

 * Properly check for thread access on UWP
 * Do some null checks with UWP
 * #292 seems to have been lost
 * Properly check for thread access on UWP
 * Do some null checks with UWP
 * #292 seems to have been lost
@mattleibow mattleibow changed the title Dev/fix uwp thread Properly check for thread access on UWP Jun 26, 2018
@dend
Copy link
Contributor

dend commented Jun 26, 2018

✅ Validation status: passed

File Status Preview URL Details
Xamarin.Essentials/MainThread/MainThread.uwp.cs ✅Succeeded

For more details, please refer to the build report.

Note: If you changed an existing file name or deleted a file, broken links in other files to the deleted or renamed file are listed only in the full build report.

@mattleibow mattleibow merged commit 7e3e6a7 into master Jun 26, 2018
@mattleibow mattleibow deleted the dev/fix-uwp-thread branch June 26, 2018 12:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants