This is a migrated thread and some comments may be shown as answers.
LinearGradientBrush and the 'The calling thread cannot access this object because a different thread owns it' exception
1 Answer 21 Views
This is a migrated thread and some comments may be shown as answers.
Stanislav
Top achievements
Rank 1
Stanislav asked on 04 Apr 2013, 03:13 AM
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

1 Answer, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 09 Apr 2013, 08:46 AM
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
Asked by
Stanislav
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Share this question
or