Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected
Context Switch Deadlock was detected Context Switch Deadlock was detected
Context Switch Deadlock was detected
Go Back  Xtreme Visual Basic Talk > > > Context Switch Deadlock was detected


Reply
 
Thread Tools Display Modes
  #1  
Old 09-15-2014, 12:13 PM
HappyJoni's Avatar
HappyJoni HappyJoni is offline
Centurion
 
Join Date: Jun 2003
Location: New Jersey
Posts: 169
Question Context Switch Deadlock was detected


I'm getting an error that reads 'Context Switch Deadlock'.

From what I've read, it's because the process that I'm performing is taking a long time. The solutions I've seen say that I should perform this process on another thread in a BackgroundWorker. The problem is, I AM using a background worker. So, needless to say, I'm confused (as usual!)!

This is the code that's causing the error. The file being read (demorespFile) is a HUGE text file and all I'm trying to do is load info from the text file into a list...



Private Sub bgw_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) _
Handles bgw.DoWork

RespondentList.Clear()

If bgw.CancellationPending Then
e.Cancel = True
Exit Sub
End If

If e.Argument IsNot Nothing Then

Dim demorespfile As String = demoFile
Dim demoRespRdr As StreamReader
demoRespRdr = File.OpenText(demorespfile)

Dim justTheDeFilename As String = Path.GetFileName(demorespfile)

Dim demoCntr As Long = 0

Do While demoRespRdr.Peek() >= 0
Dim demoRespRec As String = demoRespRdr.ReadLine
Dim demoResp As String = demoRespRec.Substring(0, 7)
Dim demoMkt As String = demoRespRec.Substring(98, 2)

demoCntr += 1

bgw.ReportProgress(0, _
demoCntr & " records read of " & justTheDeFilename & " input file(s)" & vbCrLf _
& "Building list of respondents to match for sorting...")

Dim thisDemoResp As New demoRespondents
With thisDemoResp
.demoResp = demoResp & demoMkt
End With

demoRespondentList.Add(thisDemoResp)

Loop

demoRespRdr.Close()
Attached Images
File Type: jpg error.jpg (50.2 KB, 4 views)
Reply With Quote
  #2  
Old 09-16-2014, 07:22 AM
PlausiblyDamp's Avatar
PlausiblyDampContext Switch Deadlock was detected PlausiblyDamp is offline
Ultimate Contributor

Forum Leader
* Expert *
 
Join Date: Nov 2003
Location: Newport, Wales
Posts: 2,058
Default

Hi,

One thing to be careful with is what you are doing in the background worker component's DoWork event - any code executed in here is running on a background thread and shouldn't be interacting with the UI. That means any attempts to access things like demoRespondentList are likely to fail. If you need to update things you should be doing it either in the Completed event or in the ProgressChanged event.

I am not sure if this is the source of your problem but I would certainly fix this before attempting any other troubleshooting.
__________________
Intellectuals solve problems; geniuses prevent them.
-- Albert Einstein

Posting Guidelines Forum Rules Use the code tags
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected Context Switch Deadlock was detected
Context Switch Deadlock was detected
Context Switch Deadlock was detected
 
Context Switch Deadlock was detected
Context Switch Deadlock was detected
 
-->