[Mono-devel-list] Re: [Mono-patches] r46767 - trunk/mcs/class/System.Web.Services/System.Web.Services.Protocols
Konstantin Triger
kostat at mainsoft.com
Sun Jul 3 04:00:18 EDT 2005
This requires a little bit more clean design which ensures the server is
always IDisposable. As far I understand it's always correct, but if this
changes, there will be a hard to find bug. So I decided to use a plain
try/finally block.
Thanks for notification!
Regards,
Konstantin Triger
Ben Maurer wrote:
>On Thu, 2005-06-30 at 09:29 -0400, Konstantin Triger wrote:
>
>
>
>>Modified: trunk/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs
>>===================================================================
>>--- trunk/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs 2005-06-30 13:05:37 UTC (rev 46766)
>>+++ trunk/mcs/class/System.Web.Services/System.Web.Services.Protocols/HttpSimpleWebServiceHandler.cs 2005-06-30 13:29:37 UTC (rev 46767)
>>@@ -115,9 +115,16 @@
>> try
>> {
>> object server = CreateServerInstance ();
>>- object[] res = method.Invoke (server, parameters);
>>- if (!method.IsVoid) return res[0];
>>- else return null;
>>+ try {
>>+ object[] res = method.Invoke (server, parameters);
>>+ if (!method.IsVoid) return res[0];
>>+ else return null;
>>+ }
>>+ finally {
>>+ IDisposable disp = server as IDisposable;
>>+ if (disp != null)
>>+ disp.Dispose();
>>+ }
>> }
>>
>>
>
>The cleanest way to do this is with the using statement. That
>automatically does the try...finally for you.
>
>Not only does it make the C# code clearer, it also enables a cool
>optimization to make the bytecode shorter :-).
>
>-- Ben
>
>
>
More information about the Mono-devel-list
mailing list