ContextSwitchDeadlock occurred

  • Thread starter Thread starter old_School
  • Start date Start date
O

old_School

Guest
ContextSwitchDeadlock occurred
Message: Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Users\mholmes\Documents\Visual Studio 2015\Projects\AHA_Encryption_Tool\AHA_Encryption_Tool\bin\Debug\AHA_Encryption_Tool.vshost.exe'.
Additional information: The CLR has been unable to transition from COM context 0x730ee0 to COM context 0x731050 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.


Function:

private void ImportData(string FName)
{
try
{
var lines = File.ReadLines(FName);
int linecount = File.ReadLines(FName).Count();

Processing(true, linecount);

foreach (var line in lines)
{
DataTable dt = new DataTable();
string ahaid;
string email;
string ahaPW;
string cst_key = line.ToString();
DataSet oDS = new DataSet();
oDS = AHA_Utilities.GetUserInfoByCSTKey(cst_key);

if (oDS.Tables.Count > 0)
{
ahaid = Convert.ToString(oDS.Tables[0].Rows[0]["cst_oldid"]);
email = Convert.ToString(oDS.Tables[0].Rows[0]["cst_eml_address_dn"]);
ahaPW = CryptoUtils.Encrypt("AHA" + ahaid + "AMS", "C3BC4902-A043-4A61-B51D-603DABA62575");

lstAHAID.Items.Add(ahaid);
lstEmail.Items.Add(email);
lstAHAPW.Items.Add(ahaPW);
ProgressCounter++;

if (ProgressCounter < linecount)
{
pgbProcessing.Value = ProgressCounter;
lblProcessing.Text = "Processing " + Convert.ToString(ProgressCounter) + " of " + Convert.ToString(linecount);
}
else
{
Processing(false, 0);
}
}
}
}
catch (Exception ex)
{

}
}

Continue reading...
 
Back
Top