Bug 323647 (MONO80962) - property 'Server' is not accessible for TcpListener object
Summary: property 'Server' is not accessible for TcpListener object
Status: RESOLVED INVALID
Alias: MONO80962
Product: Mono: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 1.2
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Mono Bugs
QA Contact: Mono Bugs
URL:
Whiteboard:
Keywords: accessibility
Depends on:
Blocks:
 
Reported: 2007-02-26 22:09 UTC by Benton Stak
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

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


---- Reported by benton.stark@gmail.com 2007-02-26 15:09:46 MST ----

Description of Problem:
The Server property in the class System.Net.Sockets.TcpListener is not
accessible.  This is probably an error since it is accessible in the
Microsoft .NET Framework version 2.0.50727.  Mono will produce an error
when compiling using gmcs.exe.

Steps to reproduce the problem:
1. Create a new System.Net.Sockets.TcpListener object.
2. Attempt to access the Server property. 
example code:
=====================================
TcpListener listener = new TcpListener(Dns.GetHostAddress("127.0.0.1")[0],
8888);
int avail = listener.Server.Available;

Actual Results:
error CS0122: 'System.Net.Sockets.TcpListener.Server' is inaccessible due
to its protection level

Expected Results:
compile without error

How often does this happen? 
every time

Additional Information:
Mono C# compiler version 1.2.3.1 (Windows)
gmcs.exe



---- Additional Comments From juancri@juancri.com 2007-03-21 04:11:54 MST ----

I think you're using mcs, not gmcs. The property Server is public for
NET_2_0 and protected for 1.1.



---- Additional Comments From benton.stark@gmail.com 2007-03-21 10:22:45 MST ----

I am certain I am using gmcs and not mcs. My code is littered with
generic types.  When I recompiled my .NET 2.0 FTP library using gmcs
the reported bug was the only compile error I received.  It was fairly
easy to work around the error but I thought I would report this bug so
the gmcs compiler can be fixed - and it should be a very easy fix.  I
ask you to please compile the supplied example code.



---- Additional Comments From sebastien@ximian.com 2007-03-21 10:48:19 MST ----

Would be easier if the supplied code was compilable (as
Dns.GetHostAddress doesn't exists ;-)

poupou@pollux:~/src/bugzilla> gmcs --version
Mono C# compiler version 1.2.3.50

poupou@pollux:~/src/bugzilla> gmcs 80962.cs
80962.cs(6,5): warning CS0219: The variable `avail' is assigned but
its value is never used
Compilation succeeded - 1 warning(s)

poupou@pollux:~/src/bugzilla> cat 80962.cs
using System.Net;
using System.Net.Sockets;
class Program {
static void Main () {
TcpListener listener = new
TcpListener(Dns.GetHostAddresses("127.0.0.1")[0], 8888);
int avail = listener.Server.Available;
}
}

So this works. Maybe it was fixed after 1.2.3.1 but please make sure:
(a) that you're running the latest gmcs (gmcs --version) and not
another, older one, on your system path;
(b) that you do not have a 1.0 System.dll on your current directory
(or path) that could be used instead of the 2.0 version supplied in
Mono 1.2.3.1



---- Additional Comments From benton.stark@gmail.com 2007-03-27 23:36:46 MST ----

I apologize for the code sample.  I should have given you a full test
program. :)

(a) I am running the install mono-1.2.3.1-gtksharp-2.8.3-win32-0.exe
which appears to be the latest release based on the mono web site as
of 3/27/07.  

C:\Program Files\Mono-1.2.3.1\bin>gmcs --version
Mono C# compiler version 1.2.3.1

(b) I have verified that I do not have the 1.0 System.dll in my path
or current directory.

If I had to make a guess I would say the current windows release build
is slightly different than the Linux or Unix build you are using.

--------------------------------------------------------------

Here is the command line dialog I get compiling the same program you
used. This was compiled on Windows XP Pro.  (Notice on Windows it is
not in chronological order rather than reverse order as the history
gives in UNIX).

C:\Program Files\Mono-1.2.3.1\bin>type con:1 > 8092.cs
using System.Net;
using System.Net.Sockets;
class Program {
static void Main () {
TcpListener listener = new
TcpListener(Dns.GetHostAddresses("127.0.0.1")[0], 8888);
int avail = listener.Server.Available;
}
}

C:\Program Files\Mono-1.2.3.1\bin> gmcs 8092.cs
8092.cs(7,22): error CS0122: `System.Net.Sockets.TcpListener.Server'
is inaccess
ible due to its protection level
C:\PROGRA~1\MONO-1~1.1\lib\mono\2.0\System.dll (Location of the symbol
related t
o previous error)
Compilation failed: 1 error(s), 0 warnings

C:\Program Files\Mono-1.2.3.1\bin>gmcs --version
Mono C# compiler version 1.2.3.1




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