This is a migrated thread and some comments may be shown as answers.

Exception when DesktopAlert Auto closes

2 Answers 49 Views
DesktopAlert
This is a migrated thread and some comments may be shown as answers.
Kourosh
Top achievements
Rank 1
Kourosh asked on 03 Sep 2018, 10:40 AM

Hello Telerik,

I am getting following exception message: "the calling thread cannot access this object because a different thread owns it".

I have RadDesktopAlertManager inside a separate thread and this error shows up only when DesktopAlert closes itself.

Any idea how to solve it?

Best regards

kourosh

2 Answers, 1 is accepted

Sort by
0
Kourosh
Top achievements
Rank 1
answered on 03 Sep 2018, 10:59 AM
Should I have RadDesktopAlertManager on the same thread as UI?
0
Martin Ivanov
Telerik team
answered on 04 Sep 2018, 07:01 AM
Hello kourosh,

The WPF framework is design to work with a single  thread. You can read more about this in the threading model MSDN article. This means that you cannot access UI elements on thread other than the main UI thread. If you do that the reported exception raises. To avoid this you will need to work with the desktop alert control only on the main thread. Also, note that the RadDesktopAlertManager works with the UI so you will need to use it on the main thread too.

Regards,
Martin Ivanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DesktopAlert
Asked by
Kourosh
Top achievements
Rank 1
Answers by
Kourosh
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or