[Mono-list] bug in mcs and more.

Erik Bågfors erik@bagfors.nu
30 Mar 2002 00:45:22 +0100

Hi all! 

I just started to try out mono and have no experience in c# before. 
After some small tests with p/invoke I thought I should try something
real.  I grabbed the NetRuby-compiler which compiles the
"NotRuby"-language to the .Net-platform.  It's written in c# so I
thought I should be able to compile it with mcs (well.. I'm aware that I
might not be able to do that just yet) 

Anyway, this is how it went. 

The following code didn't work. 

[assembly: AssemblyTitle("NETRuby")] 
[assembly: AssemblyVersion("0.8.*")] 
[assembly: AssemblyCopyright("NETRuby - Copyright (C) 2002 arton")] 

Knowing next to nothing about c# I just put a 

#if __MonoCS__ 

before it and "#endif" after and off we went.  I don't know if that is
important or just information. 

Next problem. 

The following code doesn't compile 
        public enum FL 
            EMPTY = 0, 
            USHIFT = 11, 
            USER0 = (1<<(USHIFT+0)), 
            USER1 = (1<<(USHIFT+1)), 
            USER2 = (1<<(USHIFT+2)), 
            USER3 = (1<<(USHIFT+3)), 
            USER4 = (1<<(USHIFT+4)), 
            USER5 = (1<<(USHIFT+5)), 
            USER6 = (1<<(USHIFT+6)), 
            USER7 = (1<<(USHIFT+7)), 
            UMASK = (0xff<<USHIFT), 
            SINGLETON = USER0, 
            FINALIZE = (1<<7), 
            TAINT = (1<<8), 
            EXIVAR = (1<<9), 
            FREEZE = (1<<10), 

This does. 

public enum FL 
    EMPTY = 0, 
    USHIFT = 11, 
    USER0 = 2048, 
    USER1 = 4096, 
    USER2 = 8192, 
    USER3 = 16384, 
    USER4 = 32768, 
    USER5 = 65536, 
    USER6 = 131072, 
    USER7 = 262144, 
    UMASK = 522240, 
    SINGLETON = 11, 
    FINALIZE = 128, 
    TAINT = 256, 
    EXIVAR = 512, 
    FREEZE = 1024, 

Which in the end is the same thing.  I guess that's a bug in mcs?? 

After that  I just get this error.

mcs --define _DEBUG --define EXCEP_TRACE --target library --debug     -o
NETRuby.dll NETRuby.cs parser.cs Scanner.cs node.cs excep.cs Symbol.cs
Object.cs Class.cs kernel.cs frmobj.cs string.cs Const.cs Numeric.cs
Bignum.cs Array.cs Loader.cs Proc.cs Thread.cs Time.cs Regexp.cs Hash.cs
Enum.cs io.cs  	

(process:990): ** WARNING **: unhandled exception
System.IndexOutOfRangeException: "Array index is out of range"
in Mono.CSharp.Delegate:Define ()
in Mono.CSharp.TypeContainer:DefineMembers ()
in Mono.CSharp.TypeContainer:Define ()
in Mono.CSharp.RootContext:PopulateTypes ()
in Mono.CSharp.Driver:MainDriver ()
in Mono.CSharp.Driver:Main ()

make: *** [NETRuby.dll] Error 1
[Exit 2 ]

I know it's to early in the mono-project to expect everything to work
but if I can find this error perhaps I can help the project as well as
having fun myself :)  How do I go about to find more information about
this error??

ps. NETRuby is a ruby-like language for the .Net-platform. 

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