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

Problem to export to excel

4 Answers 110 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Oristhony
Top achievements
Rank 1
Oristhony asked on 04 Oct 2013, 09:20 PM
regards
I'm working with RadPivotGrid and RadPivotFieldList (WPF), the data comes from a cube olap. I'm trying to export to excel but when I do after a while the application crashes and I get the following exepcion:
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x63ef2c8 to COM context 0x63ef438 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.

as I can fix, I would give an example please?

4 Answers, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 07 Oct 2013, 12:56 PM
Hi Oristhony,

Most of the time this issue is caused by non-existing Directory which you are trying to open. The open file dialog is trying to open the last location which you've opened and if it doesn't exist or if it is a network location for which you don't have access currently, such exception is raised. You can check this discussion for possible workaround.

Could you try it and inform us if it helps? I'm looking forward to hearing from you.

Regards,
Rosen Vladimirov
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Oristhony
Top achievements
Rank 1
answered on 07 Oct 2013, 11:00 PM
Hi Rosen 

First of all thank you very much for your cooperation. The cause of the problem was not because the directory does not exist trying to open, what happened was that intended to export very many records and the main thread is blocked.
The solution was to assign another thread export to excel to the main interface to remain active

Greetings!
0
Sunny
Top achievements
Rank 1
answered on 23 Feb 2017, 10:53 AM

Hi Oristhony,

am facing the same problem contextswitchdeadlock. i even tried using another thread but its throwing exception another thread owns this object. even tried dispatcher solution it didn't work. Can u provide a sample over here.

Thank you

 

 

 

 

 

0
Polya
Telerik team
answered on 27 Feb 2017, 03:55 PM
Hi Sunny,

The ContextSwitchDeadlock doesn't necessarily mean that the code has an issue, just that there is a potential. If you go to Debug > Exceptions in the menu and expand the Managed Debugging Assistants, you will find ContextSwitchDeadlock is enabled. If you disable this, Visual Studio will no longer warn you when items are taking a long time to process.

The cases of a large export of many UI elements can be considered a long-running operation, thus probably the cause of the deadlock. However, that does not mean that operation will not pass after some time and that the export will fail.
You can find more information about it here: https://msdn.microsoft.com/en-us/library/ms172233(v=vs.110).aspx

Regards,
Polya
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
PivotGrid
Asked by
Oristhony
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Oristhony
Top achievements
Rank 1
Sunny
Top achievements
Rank 1
Polya
Telerik team
Share this question
or