Click here to Skip to main content
15,888,113 members
Home / Discussions / C#
   

C#

 
QuestionC# and JavaScript. [modified] Pin
Evgeni5714-Aug-09 3:34
Evgeni5714-Aug-09 3:34 
AnswerRe: C# and JavaScript. Pin
Evgeni5717-Aug-09 1:41
Evgeni5717-Aug-09 1:41 
QuestionLogging Pin
Saksida Bojan14-Aug-09 3:02
Saksida Bojan14-Aug-09 3:02 
AnswerRe: Logging Pin
0x3c014-Aug-09 3:20
0x3c014-Aug-09 3:20 
QuestionAccess OleDb on x64 Pin
V.14-Aug-09 2:43
professionalV.14-Aug-09 2:43 
AnswerRe: Access OleDb on x64 Pin
Hristo-Bojilov14-Aug-09 22:20
Hristo-Bojilov14-Aug-09 22:20 
GeneralRe: Access OleDb on x64 Pin
V.17-Aug-09 23:43
professionalV.17-Aug-09 23:43 
Questionlog4net doesn't log in myProcess.OutputDataReceived Pin
buchstaben14-Aug-09 1:53
buchstaben14-Aug-09 1:53 
Hi,

my app logs correctly while code is beeing executed within my method DoIt. But it doesn't log in the Process.OutputDataReceived's EventHandler even if p_OutputDataReceived is called.

Is there anything I need to look at while using Process?

private void DoIt(string arguments)
{
    _log.Fatal("TEST"); // DOES LOG
    Process p = new Process();
    p.StartInfo.FileName = @"D:\vssTOOLS\NetJobs\UpdateDealArchiveInstrSeq\UpdateCaller\bin\Debug\UpdateDealArchiveInstrSeq.exe";
    p.StartInfo.RedirectStandardError = true;
    p.StartInfo.RedirectStandardOutput = true;
    p.OutputDataReceived += new DataReceivedEventHandler(p_OutputDataReceived);
    p.ErrorDataReceived += new DataReceivedEventHandler(p_ErrorDataReceived);
    p.StartInfo.WorkingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetAssembly(typeof(Caller)).Location);
    p.StartInfo.UseShellExecute = false;
    p.StartInfo.Arguments = arguments;
    p.Start();

    p.BeginOutputReadLine();
    p.BeginErrorReadLine();

    p.WaitForExit();

    //Synchronisieren
    do
    {
        System.Threading.Thread.Sleep(100);
    } while (!p.HasExited);

    if (p.ExitCode != 0)
    {
        // DOES LOG
        for (int i = 0; i < procOut.ToString().Length; i += 2000)
            _log.Info(procOut.ToString().Length > i + 2000 ? procOut.ToString().Substring(i, 2000) : procOut.ToString().Substring(i));
        for (int i = 0; i < procErr.ToString().Length; i += 2000)
            _log.Error(procErr.ToString().Length > i + 2000 ? procErr.ToString().Substring(i, 2000) : procErr.ToString().Substring(i));
        throw new ApplicationException("Es ist ein Fehler aufgetreten: " + procErr.ToString());
    }
}

StringBuilder procOut = new StringBuilder();
StringBuilder procErr = new StringBuilder();
void p_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{
    procErr.AppendLine(e.Data);
    _log.Error(e.Data); // DOES NOT LOG
}

void p_OutputDataReceived(object sender, DataReceivedEventArgs e)
{
    procOut.AppendLine(e.Data);
    _log.Info(e.Data); // DOES NOT LOG
}

QuestionSqlDataReader-Ouput Parameter And SqlConnection Pin
Nagaraj Muthuchamy14-Aug-09 1:12
professionalNagaraj Muthuchamy14-Aug-09 1:12 
AnswerRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Ashfield14-Aug-09 1:17
Ashfield14-Aug-09 1:17 
GeneralRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Nagaraj Muthuchamy14-Aug-09 1:25
professionalNagaraj Muthuchamy14-Aug-09 1:25 
GeneralRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Coding C#14-Aug-09 1:29
Coding C#14-Aug-09 1:29 
GeneralRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Ashfield14-Aug-09 2:57
Ashfield14-Aug-09 2:57 
GeneralRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Pete O'Hanlon14-Aug-09 3:01
mvePete O'Hanlon14-Aug-09 3:01 
GeneralRe: SqlDataReader-Ouput Parameter And SqlConnection Pin
Ashfield14-Aug-09 5:05
Ashfield14-Aug-09 5:05 
QuestionDisabling a button on one form from another. Pin
False Chicken14-Aug-09 0:28
False Chicken14-Aug-09 0:28 
AnswerRe: Disabling a button on one form from another. Pin
DaveyM6914-Aug-09 0:53
professionalDaveyM6914-Aug-09 0:53 
AnswerRe: Disabling a button on one form from another. Pin
DaveyM6914-Aug-09 1:00
professionalDaveyM6914-Aug-09 1:00 
GeneralRe: Disabling a button on one form from another. Pin
False Chicken14-Aug-09 1:06
False Chicken14-Aug-09 1:06 
AnswerRe: Disabling a button on one form from another. Pin
Hristo-Bojilov14-Aug-09 1:08
Hristo-Bojilov14-Aug-09 1:08 
GeneralRe: Disabling a button on one form from another. Pin
False Chicken14-Aug-09 1:15
False Chicken14-Aug-09 1:15 
GeneralRe: Disabling a button on one form from another. Pin
DaveyM6914-Aug-09 1:39
professionalDaveyM6914-Aug-09 1:39 
GeneralRe: Disabling a button on one form from another. Pin
Hristo-Bojilov14-Aug-09 2:01
Hristo-Bojilov14-Aug-09 2:01 
QuestionDelegateSerializationHolder is not permitted to be deserialized at this security level Pin
Nigel Mackay14-Aug-09 0:08
Nigel Mackay14-Aug-09 0:08 
AnswerRe: DelegateSerializationHolder is not permitted to be deserialized at this security level Pin
Hristo-Bojilov14-Aug-09 7:46
Hristo-Bojilov14-Aug-09 7:46 

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.