[Mono-bugs] [Bug 357649] GC Error: The object was used after being disposed.

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Feb 1 10:25:28 EST 2008


https://bugzilla.novell.com/show_bug.cgi?id=357649

User yhdezalvarez at gmail.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=357649#c4





--- Comment #4 from Yanko Hernandez <yhdezalvarez at gmail.com>  2008-02-01 08:25:28 MST ---
It may be. But In comment #1, the code was (I know I didn't send it, my bad):
------------------------
static public void SendMail(string users, string TextMessage, string
HTMLMessage)
{
    StreamWriter sw;
    Process myProcess;
    if (string.IsNullOrEmpty(Configuration.MailDir))
    {
        myProcess = new Process();
        myProcess.StartInfo.FileName = "/usr/sbin/sendmail";
        myProcess.StartInfo.Arguments = string.Format("-f {0} -- {1}",
            Configuration.SanitizeEmails(Configuration.Sender, ""),
            Configuration.SanitizeEmails(users, " "));
        myProcess.StartInfo.UseShellExecute = false;
        myProcess.StartInfo.RedirectStandardInput = true;
        myProcess.Start();
        sw = myProcess.StandardInput;
    }
    else
        sw = new StreamWriter(Path.Combine(Configuration.MailDir,
                                           string.Format("{0}{1}.eml",
C++.ToString("000"), users)));
    string line;
    using (StreamReader sr = new StreamReader(Configuration.EMailTemplate))
        while ((line = sr.ReadLine()) != null)
            sw.WriteLine(line.Replace("%%TEXT%%", TextMessage)
                             .Replace("%%HTML%%", HTMLMessage)
                             .Replace("%%USERS%%",
Configuration.SanitizeEmails(users, ", "))
                             .Replace("%%SENDER%%",
Configuration.SanitizeEmails(Configuration.Sender, "")));
    sw.Close();
    sw.Dispose();
}
------------------------
and it didn't worked either. 

I mean, I moved the declaration of myProcess to the outer block (and left the
construction inside the "if" block) so there were a reference to myProcess till
the end of the method execution. and like the comment says, didn't work either,
same results.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list