[Mono-list] Wrong error message given by mcs

Stefan Matthias Aust sma@3plus4.de
Fri, 10 May 2002 13:17:08 +0200

From: "Detlev Offenbach" <detlev@die-offenbachs.de>

> I am starting to learn C# using mono. The attached example taken from
> "Programming C#" doesn't compile as expected. However, the errormessage
> given by mcs (version 0.11) is not correct as it doesn't indicate the
> real problem of the code. The error I got was
> ./ex2-4.cs(5) error CS0103: The name `WriteLine' could not be found in
> `Hello'
> What I expected was something saying that using is only allowed with
> namespaces and that Console is a class.

FYI, this is the error, the csc.exe would emit:

$ csc ex2-4.cs
Microsoft (R) Visual C# .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.0.3705
Copyright (C) Microsoft Corporation 2001. All rights reserved.

ex2-4.cs(1,7): error CS0138: A using namespace directive can only be applied
        namespaces; 'System.Console' is a class not a namespace
C:\WINDOWS\Microsoft.NET\Framework\v1.0.3705\mscorlib.dll: (Location of
        related to previous error)

Actually, mcs does not detect the first error which is that you cannot use
"using" with a non-namespace.

Stefan Matthias Aust   //
www.3plus4software.de // Inter Deum Et Diabolum Semper Musica Est