Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 83847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T21:50:17+00:00 2026-05-10T21:50:17+00:00

I am calling an executable in C#. When the executable runs, it writes out

  • 0

I am calling an executable in C#. When the executable runs, it writes out to the console so the C# code is getting the console output and writing it to a text file. When the crash happens a couple of things occur.

1) The output of the text file is not completely written out. 2) The executable process seems to run completely through because it generates a report just like a successful run.

I suspect that the reason for this crash is because of how I’m writing the file out.

Update: – As far as the crash, a dialog comes up saying that the ‘Manager has encountered a problem and needs to close. We are sorry for the inconvenience.’ Then it has an OK button. When you click OK, there is a dialog that I have setup that asks if I want to start the manager again.

  • The manager application that is calling the executable is single threaded. The executable may run multi-threaded.

Here is a small snippet of the call:

  // Set up process to redirect standard output and standard error to   // a file.      process.StartInfo.UseShellExecute = false;      process.StartInfo.RedirectStandardOutput = true;      process.StartInfo.RedirectStandardError = true;      FileInfo ofi = new FileInfo(outputPath);      FileStream ofs = ofi.OpenWrite();      StreamWriter sw = new StreamWriter(ofs);      WriteToTextWriterEventHandler wtsweh = new WriteToTextWriterEventHandler(sw);      DataReceivedEventHandler handler = wtsweh.HandleDataReceived;      process.OutputDataReceived += handler;      process.ErrorDataReceived += handler;      //       statusAcceptor.ReportStatus('Running process.');      process.Start();      process.BeginOutputReadLine();      process.BeginErrorReadLine();       statusAcceptor.ReportStatus('Waiting for process to complete.');      process.WaitForExit();      int processExitCode = process.ExitCode;      process.Close();      sw.Close();     //    private class WriteToTextWriterEventHandler   {       private TextWriter tw;        public WriteToTextWriterEventHandler(TextWriter tw)       {           this.tw = tw;       }        public void HandleDataReceived(object sendingProcess,          DataReceivedEventArgs outLine)       {           // Collect the sort command output.           if (!String.IsNullOrEmpty(outLine.Data))           {               tw.Write(Environment.NewLine + outLine.Data);           }       }   } 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T21:50:18+00:00Added an answer on May 10, 2026 at 9:50 pm

    Try adding a flush after the tw.Write. That should cause the complete output up to the point of failure to be produced, which may include error messages from the executable (if that’s what is crashing?)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 94k
  • Answers 94k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This KB details which ports and protocols are used: http://support.microsoft.com/default.aspx?scid=kb;EN-US;178517… May 11, 2026 at 6:52 pm
  • Editorial Team
    Editorial Team added an answer This would query the daily maximum of value over 2008:… May 11, 2026 at 6:52 pm
  • Editorial Team
    Editorial Team added an answer This is to be expected with computer arithmetic. It is… May 11, 2026 at 6:52 pm

Related Questions

I've recently bought myself a new cellphone, running Windows Mobile 6.1 Professional. And of
I have some code in MS VC++ 6.0 that I am debugging. For some
I am running perl, v5.6.1 built for sun4-solaris-64int I am calling print on an
I am calling the SQL Server Reporting Services Webservice from inside an asp.net application.

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.