bugDotGNU Portable.NET - Bugs: bug #20790, using does not call Dispose()

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #20790: using does not call Dispose()

Submitter:  Radek Polak <radekp>
Submitted:  Wed 15 Aug 2007 03:16:38 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  ktreichel
Open/Closed:  Closed

Jump to the original submission

Sat 13 Oct 2007 09:55:27 AM UTC, comment #6: 

The using statement is fixed now for expressions.

Klaus Treichel <ktreichel>
Group administrator
Tue 09 Oct 2007 05:21:57 PM UTC, comment #5: 

Hi Klaus,
could you please commit your patch? It works perfectly for me.

Thanks
Radek

Radek Polak <radekp>
Group Member
Sun 30 Sep 2007 08:34:19 AM UTC, comment #4: 

Can you check the attached patch and see if it solves your issue?

(file #14047)

Klaus Treichel <ktreichel>
Group administrator
Sat 22 Sep 2007 03:09:11 PM UTC, comment #3: 

Hi,

i tried the patch now.
using this simple (even illegal because Object doesn't implement IDisposable) testcase:

using System;

public class Test
{
static void Test1()
{
Object a = 0;

using(a)
{
}
}
}

emits the following output:

.class public auto ansi 'Test' extends ['.library']'System'.'Object'
{
.method private static hidebysig void 'Test1'() cil managed
{
        .locals init    (class ['.library']'System'.'Object')
        ldc.i4.0
        box     ['.library']'System'.'Int32'
        stloc.0
        .try {
        leave   ?L1
        } finally {
        ldloc   39504       <--- the problem is here
        brfalse ?L2
        ldloc   39504
        callvirt        instance void [.library]System.IDisposable::Dispose()
        endfinally
?L2:
        }
?L1:
        ret
        .maxstack 1
} // method Test1

It looks like varnode is not initialized at this point.
Did you miss something in your patch?

Klaus Treichel <ktreichel>
Group administrator
Wed 19 Sep 2007 06:29:10 AM UTC, comment #2: 

Hi,
this patch might fix the issue with a one part using statement like it's used in the testcase.
So you should use the yyisa to check if it's no expressionlist because statements like using(a, b, c) are allowed too.

Klaus Treichel <ktreichel>
Group administrator
Tue 18 Sep 2007 09:11:31 PM UTC, comment #1: 

That's a quick patch, do I need to check the yyisa function to make sure the fix is implementend the right way?

(file #13984)

Franck Verrot <lxs>
Wed 15 Aug 2007 03:16:38 PM UTC, original submission:  

Hello,
this is bug in cscc compiler. It does not emit call to Dispose() method on following code block:

IDisposable obj = new SomethigDisposable();
using(obj)
{
} // Dispose() on obj should be called here

I've attached also and sample app.

Radek Polak <radekp>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #14047:  kt-070930.patch added by ktreichel (2KiB - text/x-diff - Patch that hopefully fixes the issue)
file #13984:  usingPatch.diff added by lxs (680B - text/x-patch - This patch might solve the issue.)
file #13669:  ConsoleApp1.tar.gz added by radekp (1KiB - application/gzip)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ktreichel (Posted a comment)
  • -email is unavailable- added by lxs (Updated the item)
  • -email is unavailable- added by radekp (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2007-10-13 ktreichel StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2007-09-30 ktreichel Attached File- Added kt-070930.patch, #14047
        StatusNone In Progress
        Assigned toNone ktreichel
    2007-09-18 lxs Attached File- Added usingPatch.diff, #13984
    2007-08-15 radekp Attached File- Added ConsoleApp1.tar.gz, #13669

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code