Skip to content

SimpleOrientationSensor should not schedule on Dispatcher #10905

Closed

Description

@MartinZikmund

Similarly to other sensors, the events should not be scheduled on Dispatcher to avoid swamping the UI thread. Only the user should decide whether using the sensor on UI thread is needed.

if (CoreDispatcher.Main.HasThreadAccess)
{
CalculateCurrentOrientation(orientation);
}
else
{
_ = CoreDispatcher.Main.RunAsync(CoreDispatcherPriority.Normal, () =>
{
CalculateCurrentOrientation(orientation);
});
}
? UWP Sample

This code is already in main, should it be changed?

Originally posted by @Youssef1313 in #10893 (review)

Activity

  1. self-assigned this
    on Jan 9, 2023
  2. added
    kind/bug
    project/non-ui ⚙️
    on Jan 9, 2023
  3. jeromelaban commented on Jan 9, 2023

    @jeromelaban
    Member

    It should be restored to the dispatcher using a feature flag as needed, though this particular sensors is not high-throughput so it may be too big of an issue.

    Let's add it to the list of breaking changes.

  4. self-assigned this
    on May 8, 2023
  5. added a commit that references this issue on May 9, 2023
    f6a1281
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

kind/bugproject/non-ui ⚙️

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions