Click here to Skip to main content
15,892,927 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to make a setup of windows application Pin
DJ-Boris12-Feb-09 0:10
DJ-Boris12-Feb-09 0:10 
QuestionTreeView Pin
Udayaraju11-Feb-09 19:54
Udayaraju11-Feb-09 19:54 
AnswerRe: TreeView Pin
Udayaraju12-Feb-09 1:15
Udayaraju12-Feb-09 1:15 
AnswerRe: TreeView Pin
Jimmanuel12-Feb-09 3:07
Jimmanuel12-Feb-09 3:07 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 4:53
Udayaraju15-Feb-09 4:53 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 5:09
Udayaraju15-Feb-09 5:09 
GeneralRe: TreeView Pin
Udayaraju15-Feb-09 5:20
Udayaraju15-Feb-09 5:20 
QuestionFile Processing Error Pin
MumbleB11-Feb-09 19:53
MumbleB11-Feb-09 19:53 
Hi Guys. I'm processing a bunch of files in a directory, approximately 650 files. I read each file into mem, search for "LONER" CR and replace that with a space. The search and replace works fine. However, after it has processed say 200 files it stops with the following error message. Does anybody know what it is and how I get it fixed. As you will see I am using ReadToEnd as this is the only way I can read the file inorder to correctly pick up the invalid character. I can't change this to ReadLine.

My Code:
private void button1_Click(object sender, EventArgs e)
{
    string filepath;
    filepath = textBox1.Text;
    char[] ch = { '.', 't', 'x', 't' };
    foreach (string f in Directory.GetFiles(filepath))
    {
        StreamReader sr = new StreamReader(f);
        StreamWriter sw = new StreamWriter(Path.Combine(filepath, f.Trim(ch) + ".new"));
        while (!sr.EndOfStream)
        {
            string holdLine = sr.ReadToEnd();
            if (String.IsNullOrEmpty(holdLine))
                continue;
            string output = Regex.Replace(holdLine, "\r(?!\n)", " ");
            sw.WriteLine(output);
        }
        sr.Close();
        File.Move(f, f.Trim(ch) + ".done");
        sw.Close();

Error Message:
ContextSwitchDeadlock was detected
Message: The CLR has been unable to transition from COM context 0x1a0970 to COM context 0x1a0ae0 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.


Excellence is doing ordinary things extraordinarily well.

AnswerRe: File Processing Error Pin
ABitSmart11-Feb-09 21:04
ABitSmart11-Feb-09 21:04 
GeneralRe: File Processing Error Pin
MumbleB11-Feb-09 21:08
MumbleB11-Feb-09 21:08 
AnswerRe: File Processing Error Pin
Eddy Vluggen11-Feb-09 21:25
professionalEddy Vluggen11-Feb-09 21:25 
QuestionOn button click-context menu strip Pin
Udayaraju11-Feb-09 19:47
Udayaraju11-Feb-09 19:47 
AnswerRe: On button click-context menu strip Pin
ABitSmart11-Feb-09 20:08
ABitSmart11-Feb-09 20:08 
AnswerRe: On button click-context menu strip Pin
DaveyM6911-Feb-09 22:56
professionalDaveyM6911-Feb-09 22:56 
GeneralRe: On button click-context menu strip Pin
Udayaraju15-Feb-09 4:54
Udayaraju15-Feb-09 4:54 
GeneralRe: On button click-context menu strip Pin
DaveyM6915-Feb-09 6:33
professionalDaveyM6915-Feb-09 6:33 
Questionc# Pin
aratireddy11-Feb-09 17:14
aratireddy11-Feb-09 17:14 
AnswerRe: c# Pin
ABitSmart11-Feb-09 18:43
ABitSmart11-Feb-09 18:43 
QuestionHow to create and execute of a simple Function with input and output parameters in pl/sql using with c#.net Pin
AnilJayanti11-Feb-09 16:40
AnilJayanti11-Feb-09 16:40 
Questionleading numbers in a text string appearing at end of text in a Rich Text Box. Pin
Willbo_II11-Feb-09 15:15
Willbo_II11-Feb-09 15:15 
GeneralRe: leading numbers in a text string appearing at end of text in a Rich Text Box. Pin
Luc Pattyn11-Feb-09 16:02
sitebuilderLuc Pattyn11-Feb-09 16:02 
QuestionSet license key / product in c# project - installation package. Pin
thecodesource7911-Feb-09 14:55
thecodesource7911-Feb-09 14:55 
AnswerRe: Set license key / product in c# project - installation package. Pin
DJ-Boris12-Feb-09 0:31
DJ-Boris12-Feb-09 0:31 
GeneralRe: Set license key / product in c# project - installation package. Pin
thecodesource7912-Feb-09 13:52
thecodesource7912-Feb-09 13:52 
AnswerRe: Set license key / product in c# project - installation package. Pin
Member 114976512-Dec-09 0:53
Member 114976512-Dec-09 0:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.