Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7044829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T02:27:22+00:00 2026-05-28T02:27:22+00:00

I am getting Invalid cross-thread access. When using RX Throttle Here is my code:

  • 0

I am getting

Invalid cross-thread access.

When using RX Throttle

Here is my code:

        yObs.SubscribeOnDispatcher()
            .DistinctUntilChanged()
            .Throttle(TimeSpan.FromMilliseconds(33))
            .SkipWhile(y => !_isDragging)
            .Subscribe(y =>
                           {
                               // Exception when trying to access image
                               image.RenderTransform = new CompositeTransform() { TranslateY = -y };
                               _vm.UpdateContentDrag(y / image.ActualHeight * 100);
                           });

But if I omit throttle everything works.

As far as I understand Throttle uses thread pool so OnNext doesn’t happen on UI thread. But SubscribeOnDispatcher should marshal it back to the UI thread. Shouldn’t it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T02:27:23+00:00Added an answer on May 28, 2026 at 2:27 am

    Your understanding of SubscribeOnDispatcher is incorrect. First of all, let’s distinguish between two *On operators:

    • SubscribeOn* – Runs the (un)subscription logic on the specified scheduler. Rarely used, unless you play with Observable.Create etc.
    • ObserveOn* – Runs the observer messages (OnNext, OnError, OnCompleted) on the specified scheduler. Mostly used for UI synchronization when running the “event handlers” passed to Subscribe.

    In order for your sample to work, you also should stick the ObserveOn operator use further downstream in the query. Our recommendation is to do so right in front of the final Subscribe call. Within the query, concurrency can be introduced by operators such as Throttle (whose default scheduler is the thread pool). Only at the point you need synchronization guarantees, introduce a *On operator.

    Paul’s suggestion to parameterize the Throttle call is a good one too. In cases where you can control all the concurrency introduced, you may want to do so. However, there are many cases where you are handed an IObservable sequence that is ill-behaved with regards to synchronization requirements, requiring the use of *On operators.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting an 'UnauthorizedAccesExpection - Invalid cross-thread access' exception when I try to raise
I'm getting the invalid lvalue error using gcc 3.4.6. The line that invokes the
I keep getting a Request format is invalid. Here's the raw http that gets
Getting Invalid Application Path error. Here are the steps I've taken. Right click on
Im getting invalid argument error when running the following code. Im trying to change
I am getting invalid memory error on following code: printf( %s\n,FINE 5); printf(%s LENGTH
I'm getting the error Invalid argument supplied for foreach() even though the array being
I'm getting this error: The remote certificate is invalid according to the validation procedure.
I am getting this error: Data at the root level is invalid. Line 1,
I'm having some problems getting my object to gracefully fail out if an invalid

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.