PDA

View Full Version : سوال: خطای DeadLock Detection



pbm_soy
جمعه 21 آبان 1389, 01:30 صبح
سلام

من می خواستم خطوط یک فایل متنی را در تکست باکس نمایش دهم با این شرط که خطوط خاصی که قالب درستی ندارند را نمی خواستم نمایش دهم و یا می خواستم آنها جداگانه در تکست باکش دیگری نمایش داده شوند
هر دو کد زیر یک خطا را در زمان اجرا می دهند و همینطور اگر تعداد خطوط فایل زیاد باشند این خطا ظاهر می شود!!!
خطا از خط اول for می گیرد خطای DeadLock Detection و زیر آن توضیحات زیر را نمایش می دهد


The CLR has been unable to transition from COM context 0x1a2668 to COM context 0x1a27d8 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.


openFileDialog1.ShowDialog();
String fn = openFileDialog1.FileName;
if (fn.Length == 0) return;
StreamReader fsr = new StreamReader(fn);
//textBox1.Text = fsr.ReadToEnd();

string ss = fsr.ReadLine();
while (!fsr.EndOfStream)
{
textBox1.Text += ss;
ss = fsr.ReadLine();
}



openFileDialog1.ShowDialog();
String fn = openFileDialog1.FileName;
if (fn.Length == 0) return;
StreamReader fsr = new StreamReader(fn);
textBox1.Text = fsr.ReadToEnd();


UInt16 i = 0;
string s;
for (i = 0; i < textBox1.Lines.Length ; i++ )
{
s = textBox1.Lines[i].Trim();
textBox2.Text += Environment.NewLine + s;
}

pbm_soy
شنبه 28 اسفند 1389, 20:36 عصر
کسی نظری نداره ؟؟؟؟؟؟؟!!!!!!!