[Mono-bugs] [Bug 541052] Inspecting empty value type variable shows null value

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Oct 12 00:44:42 EDT 2009


http://bugzilla.novell.com/show_bug.cgi?id=541052

User martin at novell.com added comment
http://bugzilla.novell.com/show_bug.cgi?id=541052#c1


Martin Baulig <martin at novell.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FEATURE
            Summary|Inspecting value type       |Inspecting empty value type
                   |variable shows null value   |variable shows null value




--- Comment #1 from Martin Baulig <martin at novell.com>  2009-10-11 22:44:41 MDT ---
I'd call this a feature, not a bug - and there's also nothing I can do about
this in the debugger.

Since the size of the struct is zero, the JIT doesn't allocate any storage for
it.  The same applies to the static field - it's a value type of zero size, so
there's also no storage allocated for it, and the JIT also doesn't call any
kind of .cctor for it.

Things change when you add a field to it:

=====
asgard at isengard:debugger$ cat test/V.cs
using System;

struct S
{
    public int a;
    public static S Null = new S ();
}

class Program
{
    static void Main (string[] args)
    {
        S s = new S ();
        s.a = 9;
        Environment.Exit (1);
    }
}
asgard at isengard:debugger$ mdb -run ./test/V.exe
Mono Debugger
Starting program: ./test/V.exe 
Thread @1 stopped at #0: 0x40e8a278 in Program.Main(string[])+0x28 at
/work/asgard/debugger/test/V.cs:14.
  14         s.a = 9;
(mdb) p s
(S) { a = 0 }
(mdb) p S.Null
(S) { a = 0 }
(mdb) n
Thread @1 stopped at #0: 0x40e8a28b in Program.Main(string[])+0x3b at
/work/asgard/debugger/test/V.cs:15.
  15         Environment.Exit (1);
(mdb) p s
(S) { a = 9 }
(mdb) p S.Null
(S) { a = 0 }
======

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list