LinearGradientBrush and the 'The calling thread cannot access this object because a different thread owns it' exception

2 posts, 0 answers
  1. Stanislav
    Stanislav avatar
    1 posts
    Member since:
    May 2012

    Posted 03 Apr 2013 Link to this post

    Hello Telerik,

    I get the following exception, when I try to get information about the color in Rectangle element:

    [WPF Extension Error] Details: System.InvalidOperationException: The calling thread cannot access this object because a different thread owns it.
       at System.Windows.Threading.Dispatcher.VerifyAccess()
       at System.Windows.Media.GradientStopCollection.System.Collections.IEnumerable.GetEnumerator()
       at Telerik.TestingFramework.XamlExtension.ClientProcessor.ObjectToString(Object obj, Boolean isAutomationPeer, Type objType)
       at Telerik.TestingFramework.XamlExtension.ClientProcessor.ProcessCommand(String command)


    Code:
    var rect = app.MainWindow.Find.AllByType<Rectangle>();
    var brush = rect[0].Fill as LinearGradientBrush;
    var color = brush.GradientStops[0].Color; //here the exception is occurred

    Thank you.

    Kind Regards,
    Stanislav Hordiyenko
  2. Boyan Boev
    Admin
    Boyan Boev avatar
    1039 posts

    Posted 09 Apr 2013 Link to this post

    Hello Stanislav,

    I was able to reproduce this issue. I have created a bug report for this behavior, which you can follow in our Feedback Portal.

    We appreciate your feedback, which we rely on to improve our product.  

    Regards,
    Boyan Boev
    the Telerik team
    Quickly become an expert in Test Studio, check out our new training sessions!
    Test Studio Trainings
Back to Top