[Mono-dev] ThreadAbortException during compilation path

Vorobiev Maksim MVorobiev at croc.ru
Tue Aug 16 12:04:17 EDT 2005


Good day.
 
We have encounted an issue with CSharpCodeCompiller class. Then there is
a termination of thread, that startups compilation (and waits for
ExitCode), it gots ThreadAbortException and goes to finally block. But
the process of mcs is still running! So, it should not check for
ExitCode. In case then mcs still running, we got
InvalidOperationException, that hides ThreadAbortException.
This is the current code:
 
   try {
    mcs.Start();
    // If there are a few kB in stdout, we might lock
    mcs_output=mcs.StandardError.ReadToEnd();
    mcs.StandardOutput.ReadToEnd ();
    mcs.WaitForExit();
   } finally {
    results.NativeCompilerReturnValue = mcs.ExitCode; // <--
!!!!!!!!!!This line
    mcs.Close();
   } 
 
May be it's better to change for this?
 
   try {
    mcs.Start();
    // If there are a few kB in stdout, we might lock
    mcs_output=mcs.StandardError.ReadToEnd();
    mcs.StandardOutput.ReadToEnd ();
    mcs.WaitForExit();
    results.NativeCompilerReturnValue = mcs.ExitCode; // <-- !!!!!! Goes
from finally to try block
   } finally {
    mcs.Close();
   } 
 
The patch is attached. If there is no disagreement, apply this patch to
CVS.

Thank you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: CSharpCodeCompiler.diff
Type: application/octet-stream
Size: 409 bytes
Desc: CSharpCodeCompiler.diff
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050816/95b32755/attachment.obj 


More information about the Mono-devel-list mailing list