Bug 32777 - [Lollipop] Calling System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces() hangs on Lollipop.
Summary: [Lollipop] Calling System.Net.NetworkInformation.NetworkInterface.GetAllNetwo...
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 5.1
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Marek Habersack
URL:
Depends on:
Blocks:
 
Reported: 2015-08-04 23:06 UTC by Jon Goldberger [MSFT]
Modified: 2015-08-11 04:31 UTC (History)
2 users (show)

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


Attachments
Test Project (42.50 KB, application/zip)
2015-08-04 23:06 UTC, Jon Goldberger [MSFT]
Details


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:
Status:
VERIFIED FIXED

Description Jon Goldberger [MSFT] 2015-08-04 23:06:13 UTC
Created attachment 12359 [details]
Test Project

#Description

Calling the above method, System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces(), works on Jelllybean and KitKat but freezes app on Lollipop (Android version 5.1). No exception is thrown, app just hangs indefinitely. I do not have a Lollipop device to test with unfortunately. I did test on a Google emulator running Android 5.0.2 and that worked as expected. OK, wait, hold the phone. I just created a Google Nexus S emulator running Android 5.1 and that worked as expected as well, so this _may_ be an issue with the image used for XAP Android 5.1 devices? I will leave the bug report here for now, feel free to move if the issue is with the XAP image. Another possible difference is that I have the Google Play Services installed on the XAP 5.1 simulator but do not have it installed on the Google 5.1 emulator. The reporting customer said he hit this issue in "all use cases for API 21 and 22." My experience, as noted, is different. 

## Steps to reproduce:

1. Open the attached sample app and launch to a XAP Lollipop simulator.

2. Click the button.

Expected result: Button text will change to the number of found interfaces and the interfaces will be listed in the Console output.

Actual result: App hangs with no exception thrown. 

## Workaround

A workaround is to use the native methods to get the interface. The workaround is included in the project but commented out. 

Example:

>var net = GetEnumerable<Java.Net.NetworkInterface>(Java.Net.NetworkInterface.NetworkInterfaces);
>
>foreach (Java.Net.NetworkInterface networkInterface in net.ToList()) {
>    Console.WriteLine ("Interface: {0}", networkInterface.DisplayName);
>}



## My environment

=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: ea05fb63-6c76-4560-a945-6d36433afad7
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Xamarin.Android ===

Version: 5.1.4.16 (Business Edition)
Android SDK: /Users/apple/Library/Developer/Xamarin/android-sdk-mac_x86
	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_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

=== Xamarin Android Player ===

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

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

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

=== Xamarin.Mac ===

Version: 2.0.2.35 (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.10.4
Darwin Jons-iMac.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 Arpit Jha 2015-08-05 06:32:53 UTC
I have checked this issue and able to reproduce this issue with the help of bug description.

Screencast: http://www.screencast.com/t/jJGZlHQRJLOc
XAP device log: https://gist.github.com/Arpit360/c0be3c944c014a5fe11c

Environment Info:
=== Xamarin Studio ===

Version 5.9.4 (build 5)
Installation UUID: 3d25a767-a003-4a7d-9f5e-e57987cf6cf0
Runtime:
	Mono 4.0.2 ((detached/c99aa0c)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 400020005

=== Xamarin.Android ===

Version: 5.1.4.16 (Enterprise Edition)
Android SDK: /Users/mac360_xamarin/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

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

=== Apple Developer Tools ===

Xcode 6.3 (7569)
Build 6D570

=== Xamarin.iOS ===

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

=== Xamarin.Mac ===

Version: 2.0.2.35 (Enterprise 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.10.4
Darwin mac360-xamarins-Mac-mini.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 2 Marek Habersack 2015-08-10 12:13:32 UTC
@arpit can you please test with the current Xamarin.Android master builds as well?
Comment 3 Arpit Jha 2015-08-11 04:31:27 UTC
@Marek, I have checked this issue with master XA 5.1.99-535 and its works fine at my end.

For now I am closing this issue .

Screencast: http://www.screencast.com/t/wXcDY7YVNsn