Bug 316538 (MONO69926) - struct X {} X x = new X (); using (x) ;
Summary: struct X {} X x = new X (); using (x) ;
Status: RESOLVED FIXED
Alias: MONO69926
Product: Mono: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 1.0
Hardware: Other Other
: P3 - Medium : Major
Target Milestone: ---
Assignee: Ben Maurer
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-11-26 00:12 UTC by Ben Maurer
Modified: 2007-09-15 21:24 UTC (History)
0 users

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
Patch! (2.06 KB, patch)
2004-11-26 00:40 UTC, Thomas Wiest
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Wiest 2007-09-15 18:59:46 UTC


---- Reported by bmaurer@users.sf.net 2004-11-25 17:12:27 MST ----

using System;

struct X : IDisposable {
	public void Dispose ()
	{
	}
	
	static void Main ()
	{
		X x = new X ();
		using (x)
			;
	}
}

[benm@omega benm]$ mcs t.cs
Compilation succeeded
[benm@omega benm]$ mono t.exe
 
** ERROR **: Invalid IL code at IL0015 in X:Main (): IL_0015: ldloc.1
 
 
aborting...
Aborted


[benm@omega benm]$ monodis t.exe
.assembly extern mscorlib
{
  .ver 1:0:5000:0
  .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
}
.assembly 't'
{
  .hash algorithm 0x00008004
  .ver  0:0:0:0
}
.module t.exe // GUID = {9F2B4A60-8B89-4FBC-8166-4F83C2BB0890}
 
 
  .class private sequential ansi sealed beforefieldinit X
        extends [mscorlib]System.ValueType
        implements [mscorlib]System.IDisposable  {
    .field  private   unsigned int8 $PRIVATE$
 
    // method line 1
    .method public final  virtual  hidebysig  newslot
           instance default void Dispose ()  cil managed
    {
        // Method begins at RVA 0x20ec
        // Code size 1 (0x1)
        .maxstack 8
        IL_0000:  ret
    } // end of method X::instance default void Dispose ()
 
    // method line 2
    .method private static  hidebysig
           default void Main ()  cil managed
    {
        // Method begins at RVA 0x20f0
        .entrypoint
        // Code size 29 (0x1d)
        .maxstack 2
        .locals init (
                valuetype X     V_0,
                valuetype X     V_1)
        IL_0000:  ldloca.s 0
        IL_0002:  initobj X
        IL_0008:  ldloc.0
        IL_0009:  stloc.1
        .try { // 0
          IL_000a:  leave IL_001c
 
        } // end .try 0
        finally  { // 0
          IL_000f:  ldloc.1
          IL_0010:  brfalse IL_001b
 
          IL_0015:  ldloc.1
          IL_0016:  callvirt instance void class
[mscorlib]System.IDisposable::Dispose()
          IL_001b:  endfinally
        } // end handler 0
        IL_001c:  ret
    } // end of method X::default void Main ()
 
  } // end of class X



---- Additional Comments From bmaurer@users.sf.net 2004-11-25 17:40:22 MST ----

Created an attachment (id=167083)
Patch!




---- Additional Comments From bmaurer@users.sf.net 2004-11-25 18:31:26 MST ----

Fixed on r36570 in head, r36571 in 1.0



---- Additional Comments From bmaurer@users.sf.net 2004-12-03 20:13:24 MST ----

This regressed in 1.0, (but not head)



---- Additional Comments From miguel@ximian.com 2004-12-08 23:06:33 MST ----

Could you look at the issue Ben?

Also, it would be nice to show how it regressed (the "ex" error).



---- Additional Comments From bmaurer@users.sf.net 2004-12-10 23:11:54 MST ----

In my stupidity, I removed

ig.BeginFinallyBlock ()

When merging this patch in, making fucked up IL.


Imported an attachment (id=167083)

Unknown operating system unknown. Setting to default OS "Other".