Bug 31724 - [Android.Xamarin Version 5.0]Deprecation of System.Net.NetworkInformation.IPGlobalProperties.GetActiveTcpListeners()
Summary: [Android.Xamarin Version 5.0]Deprecation of System.Net.NetworkInformation.IPG...
Alias: None
Product: Android
Classification: Xamarin
Component: Mono runtime / AOT Compiler ()
Version: 5.1
Hardware: Other Other
: Normal normal
Target Milestone: ---
Assignee: Marek Habersack
Depends on:
Reported: 2015-07-07 16:18 UTC by Sunil
Modified: 2017-09-14 19:16 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Sunil 2015-07-07 16:18:20 UTC

The Api System.Net.NetworkInformation.IPGlobalProperties.GetActiveTcpListeners() was supported as part of Xamarin.iOS version; however when updated to latest version (version 5.0 and above) there is run time issue related 'GetActiveTcpListeners()' that this API is not implemented.

Is the removal of this implementation intentional? If it is intentional is there any other api with which we can get the active ports. I could not find any other as part of API documentation.

Thanks & Regards,
Comment 1 Rajneesh Kumar 2015-07-08 06:49:46 UTC
I tried to reproduce this issue but not able to reproduce. I tried to search in assembly browser for GetActiveTcpListeners() but getting same behaviour with XA an XA Please have a look on screencast: 

Could you please share steps to reproduce this issue or any sample application that demonstrate this issue? That would be very helpful to reproduce this issue at our end.


Environment Info:

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Xamarin.Android ===

Version: (Business Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: Unknown version
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 6.2 (6776)
Build 6C131e

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 8b265d6
Branch: master
Build date: 2015-06-30 15:19:13-0400

=== Xamarin.Mac ===

Version: (Business Edition)

=== Build Information ===

Release ID: 509040005
Git revision: 8010a90f6e246b32364e3fb46ef2c9d1be9c9a2b
Build date: 2015-06-08 16:52:06-04
Xamarin addins: 7e93e9c3503f28770f23ce1b7eafd829919f18e8

=== Operating System ===

Mac OS X 10.9.5
Darwin MacMini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64
Comment 2 Rajneesh Kumar 2015-07-08 06:51:23 UTC
An update to above comment:

Screencast: http://www.screencast.com/t/aseWJhLho
Comment 3 Sunil 2015-07-08 10:35:39 UTC

Thanks for the quick response. Will get back with android app built with latest Xamarin.Android.

Thanks & Regards,
Comment 4 Jonathan Pryor 2015-07-08 12:26:59 UTC
> System.Net.NetworkInformation.IPGlobalProperties.GetActiveTcpListeners() was
> supported as part of Xamarin.iOS version

I think you're confusing products and versions; Xamarin.iOS != Xamarin.Android, and I don't think there ever was a Xamarin.iOS v4.20.0.28...

Regardless, source!

There are four references to GetActiveTcpListeners():


The first is the `abstract` method declaration. The second is UnixIPGlobalProperties.GetActiveTcpListeners(), which throws NotImplementedException. The third is in MibIPGlobalProperties, which is some Unix variant, and the fourth is in Win32IPGlobalProperties, which is for Windows.

Android uses AndroidIPGlobalProperties, which inherits UnixIPGlobalProperties.GetActiveTcpListeners:


Which is why you get the NotSupportedException.

That said, the above is for Mono 4.0, which is used in Xamarin.Android 5.1. What about Xamarin.Android 4.20?

Xamarin.Android 4.20 used Mono 3.10, which doesn't have any Android checks...and will *instead* throw NotSupportedException from IPGlobalProperties.GetIPGlobalProperties():


In short, as far as I can tell this never worked on Android.
Comment 5 Sunil 2015-07-08 12:56:31 UTC
Hi Jon,

Thanks for the detailed response.

I'm sorry, you are right it is Xamarin.Android not the iOS.

It works well with the Xamarin.Android v4.20.0.28; though not sure about the mono version used with this; is there a way to check the mono version?

The problem was when upgraded to the latest Xamarin.Android version it throws 'NotSupportedException'.

>>Xamarin.Android 4.20 used Mono 3.10, which doesn't have any Android
checks...and will *instead* throw NotSupportedException from

Below is the code snippet, which works well with Xamarin.Android v4.20.0.28;
IPGlobalProperties properties = IPGlobalProperties.GetIPGlobalProperties();
IPEndPoint[] ipEndPoints = properties.GetActiveTcpListeners();

Xamarin versions used with Visual Studio :

Xamarin (10cfd178d55287f09c85f5a1e604dfe20889a40f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android (ba9bbbdd44cfdc4bf485e8885bd2ad24fba525f7)
Visual Studio plugin to enable development for Xamarin.Android.

Xamarin.iOS (840a925103a0bf4a856507f13d5eaee3c1579c2f)
Visual Studio extension to enable development for Xamarin.iOS.

Comment 6 Jon Douglas [MSFT] 2017-09-14 19:16:06 UTC
Thank you for taking the time to submit this report. After reviewing the description of this bug, we believe it no longer affects the current version of Xamarin.Android. If you are still experiencing the issue after updating your packages, please reopen this report with an attached reproduction.