Bug 16409 - Implement AndroidEnvironment._Proxy.Credentials property.
Summary: Implement AndroidEnvironment._Proxy.Credentials property.
Status: VERIFIED FIXED
Alias: None
Product: Android
Classification: Xamarin
Component: General ()
Version: 4.10.0.x
Hardware: PC Windows
: Normal normal
Target Milestone: 5.1
Assignee: Marek Habersack
URL:
Depends on:
Blocks:
 
Reported: 2013-11-22 15:11 UTC by Jon Goldberger [MSFT]
Modified: 2015-05-05 12:01 UTC (History)
3 users (show)

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


Attachments
Android Device Log (200.50 KB, text/plain)
2013-11-22 15:16 UTC, Jon Goldberger [MSFT]
Details
Xamarin.Android (69.98 KB, text/plain)
2013-11-22 15:17 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

Comment 1 Jon Goldberger [MSFT] 2013-11-22 15:15:44 UTC
After the last update those two lines of code started giving the exception attached:
IWebProxy defaultProxy = WebRequest.GetSystemWebProxy();
defaultProxy.Credentials = CredentialCache.DefaultCredentials;
-------------------------------------------------------------------
Exception:
Source: Mono.Android\r\nMessage: Operation is not valid due to the current state of the object
Stack trace:   at Android.Runtime.AndroidEnvironment+_Proxy.set_Credentials (ICredentials value) [0x00000] 
in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.1-branch/d23a19bf/source/monodroid/src/Mono.Android/src/Runtime/AndroidEnvironment.cs:274
at MessageVault.Client.iOS.Sikur.Initialize (System.String apnRegistration, System.String deviceID, System.String platform) [0x0000f] 
in c:\\Projects\\MessageVault\\Source\\Beta\\Application\\MessageVault Client Android\\Sikur.cs:89 Full: System.InvalidOperationException: Operation is not valid due to the current state of the object
at Android.Runtime.AndroidEnvironment+_Proxy.set_Credentials (ICredentials value) [0x00000] in /Users/builder/data/lanes/monodroid-mlion-monodroid-4.10.1-branch/d23a19bf/source/monodroid/src/Mono.Android/src/Runtime/AndroidEnvironment.cs:274
at MessageVault.Client.iOS.Sikur.Initialize (System.String apnRegistration, System.String deviceID, System.String platform) [0x0000f] 
in c:\\Projects\\MessageVault\\Source\\Beta\\Application\\MessageVault Client Android\\Sikur.cs:89 

-------------------------------------------------------------------
version info:
=== Xamarin Studio ===

Version 4.2.1 (build 1)
Installation UUID: 61bd6f6a-2f55-428e-9832-32032ef6b63c
Runtime:
Microsoft .NET 4.0.30319.18051
GTK+ 2.24.20 theme: MS-Windows
GTK# (2.12.0.0)

=== Xamarin.Android ===

Version: 4.10.1 (Business Edition)
Android SDK: C:\Users\Leonardo\AppData\Local\Android\android-sdk
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
4.0 (API level 14)
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)
Java SDK: C:\Program Files (x86)\Java\jdk1.6.0_39
java version "1.6.0_39"
Java(TM) SE Runtime Environment (build 1.6.0_39-b04)
Java HotSpot(TM) Client VM (build 20.14-b01, mixed mode, sharing)

=== Build Information ===

Release ID: 402010001
844a84fe0aa0cb5f986d4e3c4807a51487d07845
Build date: 2013-11-13 16:45:15Z
Xamarin addins: 97e44e4863da6c479427794457637e75b3d22600

=== Operating System ===

Windows 6.2.9200.0 (64-bit)

Microsoft Visual Studio Ultimate 2012
Version 11.0.61030.00 Update 4
Microsoft .NET Framework
Version 4.5.50709

Installed Version: Ultimate

Architecture and Modeling Tools 04940-004-0038003-02686
Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Team Explorer for Visual Studio 2012 04940-004-0038003-02686
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012 04940-004-0038003-02686
Microsoft Visual Basic 2012

Visual C# 2012 04940-004-0038003-02686
Microsoft Visual C# 2012

Visual C++ 2012 04940-004-0038003-02686
Microsoft Visual C++ 2012

Visual F# 2012 04940-004-0038003-02686
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker 04940-004-0038003-02686
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

ASP.NET and Web Tools 2012.3.41009
Microsoft Web Developer Tools contains the following components:
Support for creating and opening ASP.NET web projects
Browser Link: A communication channel between Visual Studio and browsers
Editor extensions for HTML, CSS, and JavaScript
Page Inspector: Inspection tool for ASP.NET web projects
Scaffolding: A framework for building and running code generators
Server Explorer extensions for Windows Azure Web Sites
Web publishing: Extensions for publishing ASP.NET web projects to hosting providers, on-premises servers, or Windows Azure

AWS Toolkit for Visual Studio 2012 1.4.0.4
AWS Toolkit for Visual Studio 2012.
Copyright 2011-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.

This software includes third party software subject to the following copyrights:
- WPF Toolkit for charting and grid controls, Microsoft Public License (Ms-PL)
[http://wpf.codeplex.com/license]
- Logging from log4net, Apache License
[http://logging.apache.org/log4net/license.html]
- Putty for PPK to PEM conversion, MIT license
[http://www.chiark.greenend.org.uk/~sgtatham/putty/licence.html]
- NGit for AWS Elastic Beanstalk incremental push
[https://github.com/mono/ngit/blob/master/NGit.license.txt]
- NSch dependency for NGit
[https://github.com/mono/ngit/blob/master/NSch.license.txt]
- Sharpen dependency for NGit
[https://github.com/mono/ngit/blob/master/Sharpen/AssemblyInfo.cs]
- ICSharpCode.SharpZipLib dependency for NGit
[http://www.icsharpcode.net/opensource/sharpziplib/]
- Mono.Posix.dll and Mono.Security.dll dependencies for NGit
[http://mono-project.com/FAQ:_Licensing#Licensing]
- MPFProj for Visual Studio Project Framework
[http://mpfproj10.codeplex.com/license]
- JSONLint for JSON validation
[https://github.com/zaach/jsonlint/blob/master/README.md]
- Noesis.Javascript.dll for JSON validation
[http://javascriptdotnet.codeplex.com/license]

BusinessObjectEditor 1.0
Information about my package

Common Azure Tools 1.0
Provides common services for use by Azure Mobile Services and Windows Azure Tools.

CreateLayoutWizardPkg 1.0
Create layout wizard.

DevExpress.ExpressApp.DesignPackage 1.0
DevExpress VSIX Package

InstallShield 2013 Editor
InstallShield. For more information visit the Flexera Software website at <http://www.FlexeraSoftware.com>;. For customer support visit <http://support.InstallShield.com>;. Copyright © 2013 Flexera Software LLC. All Rights Reserved.

JetBrains ReSharper 7.0.1 Full Edition build 7.0.1098.2760 on 2012-08-27T19:31:12
JetBrains ReSharper 7.0.1 package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper/. Copyright © 2003–2013 JetBrains, Inc.

Mobile.Design 1.0
Information about my package

NuGet Package Manager 2.7.41101.299
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 11.1.31009.1
Microsoft SQL Server Data Tools

Windows Azure Tools October 2012
Windows Azure Tools for Microsoft Visual Studio 2012 - October 2012 v1.8.51019.1603

Windows Azure Tools 2.0
Windows Azure Tools for Microsoft Visual Studio 2012 - v2.0.60409.1601

Windows Azure Tools 2.1
Windows Azure Tools for Microsoft Visual Studio 2012 - v2.1.10716.1601

Windows Installer XML Toolset 3.7
Windows Installer XML Toolset 3.7.1224.0
Copyright © Outercurve Foundation. All rights reserved.

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

Xamarin.iOS 1.8.365 (8cb9dbd0)
Visual Studio extension to enable development for Xamarin.iOS

XtraReports package 1.0
XtraReports package
Comment 2 Jon Goldberger [MSFT] 2013-11-22 15:16:28 UTC
Created attachment 5513 [details]
Android Device Log
Comment 3 Jon Goldberger [MSFT] 2013-11-22 15:17:40 UTC
Created attachment 5514 [details]
Xamarin.Android
Comment 4 Jon Goldberger [MSFT] 2013-11-22 15:53:57 UTC
Tested in a console app. Exception does not occur and credentials are set.
Comment 5 Marek Habersack 2014-12-10 10:20:34 UTC
Fixed in monodroid/master, commit 5e28001f273ad548e4537f3f9304107ac941810a
Comment 6 Rajneesh Kumar 2015-05-05 12:01:23 UTC
I have checked this issue with the following builds:

Microsoft Visual Studio Professional 2013
Version 12.0.31101.00 Update 4
Microsoft .NET Framework
Version 4.5.50938
Installed Version: Professional
Xamarin   3.11.507.0 (dfac85e)
Visual Studio extension to enable development for Xamarin.iOS and
Xamarin.Android.
Xamarin.Android   5.1.0.127 (cbdf025e886eacb95ce7adf53346961156fae990)
Visual Studio plugin to enable development for Xamarin.Android.

I observed that this issue working fine. Now, user does't get exception when
implementing following line of code:
 IWebProxy defaultProxy = WebRequest.GetSystemWebProxy();
 defaultProxy.Credentials = CredentialCache.DefaultCredentials;

Here is the screencast for the same: http://www.screencast.com/t/TXWlQZ8Z

This issue has been fixed hence I am closing this issue.

Thanks..!