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()

Submitted by:  Radek Polak <radekp>
Submitted on:  Wed 15 Aug 2007 03:16:38 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: Klaus Treichel <ktreichel>
Open/Closed: Closed

(Jump to the original submission 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>
Project AdministratorIn charge of this item.
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>
Project 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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project Member

 

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
  • -unavailable- added by ktreichel (Posted a comment)
  • -unavailable- added by lxs (Updated the item)
  • -unavailable- added by radekp (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 13 Oct 2007 09:55:27 AM UTCktreichelStatusIn Progress=>Fixed
      Open/ClosedOpen=>Closed
    Sun 30 Sep 2007 08:34:19 AM UTCktreichelAttached File-=>Added kt-070930.patch, #14047
      StatusNone=>In Progress
      Assigned toNone=>ktreichel
    Tue 18 Sep 2007 09:11:31 PM UTClxsAttached File-=>Added usingPatch.diff, #13984
    Wed 15 Aug 2007 03:16:38 PM UTCradekpAttached File-=>Added ConsoleApp1.tar.gz, #13669

    Back to the top


    Powered by Savane 3.1-cleanup1