[Mono-dev] ThreadAbortException during compilation path

Miguel de Icaza miguel at ximian.com
Thu Aug 25 11:08:06 EDT 2005


Hello,


> 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.

How can we reproduce this bug?

Miguel.

> 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.
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
-- 
Miguel de Icaza <miguel at ximian.com>



More information about the Mono-devel-list mailing list