[Mono-list] BUG in mcs

Erik Bagfors erik@bagfors.nu
25 Jul 2002 15:42:01 +0200

For some reason I can't get bugzilla to mail me my password. It says it
does but I never get it.  So I can't put this in bugzilla.

Anyway,  Just for fun I tried to compile a few applications/libraries
from the windows c#-world.  It seams like mono will soon be where it's
no problem doing this.  But not quite yet.

I found a strange problem that I think is a bug in mcs.  Here is the
smallest code I've been able to get that shows this problem.

using System;

public class ZipEntry 
    DateTime cal = DateTime.Now;
    string name;

    public ZipEntry(string name)
	this.name = name;

    public ZipEntry(ZipEntry e)
	name = e.name;

    public DateTime DateTime {
	get {
	    return cal;


: [bagfors@detrius]$ ; mcs --target library  test2.cs
test2.cs(5) error CS0176: Static member `Now' cannot be accessed with an
instance reference, qualify with a type name instead
Compilation failed: 1 error(s), 0 warnings
[Exit 1 ]

It seams like there is some resolving that is wrong.  The line "DateTime
cal = DateTime.Now;" seams to use the DateTime attribute defined later
instead of using System.DateTime.New like it should.

Changing the line to "DateTime cal = System.DateTime.Now" solves the
problem, or renaming the attribute, or removing any of the constructors
(yes.. both are needed to get this error).

The code works great in csc btw,

Sorry I couldn't file this in bugzilla.

BTW, I saw that the attribute "Name" is missing in System.IO.FileStream
as well.  That's real easy to fix.  Will someone or should I send in a


Erik Bågfors               | erik@bagfors.nu
Supporter of free software | GSM +46 733 279 273
fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32