Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
AllowCookies seems to have no effect.
> var binding = new BasicHttpBinding();
> binding.Security.Mode = BasicHttpSecurityMode.Transport;
> binding.AllowCookies = true;
> bool l = await ws.Login(binding, "username", "password");
**Steps to Reproduce:**
1. Run the attached sample.
2. Press the Login button.
An exception occurs:
> Unable to set the CookieContainer. Please make sure the binding contains an HttpCookieContainerBindingElement.
> at Test.PCL.ServiceReference1.AuthenticationServiceClient.set_CookieContainer (System.Net.CookieContainer value) [0x00027] in /Users/John/Downloads/PCLWebServiceTest/Test.PCL/Service >References/ServiceReference1/Reference.cs:177
> at Test.PCL.WebServices.Login (System.ServiceModel.Channels.Binding binding, System.String userName, System.String password) [0x00044] in /Users/John/Downloads/PCLWebServiceTest/Test.PCL/WebServices.cs:26
>--- End of stack trace from previous location where exception was thrown ---
> at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
> at System.Runtime.CompilerServices.TaskAwaiter`1[System.Boolean].GetResult () [0x00000] in <filename unknown>:0
> at Test.Droid.Activity1+<button_Click>c__async0.MoveNext () [0x000be] in /Users/John/Downloads/PCLWebServiceTest/Test.Droid/Activity1.cs:52
await ws.Login(...) returns true and successful login.
**Build Date & Platform:**
This seems to be a workaround, but HttpCookieContainerBindingElement is obsolete.
> var _binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport);
> var customBinding = new CustomBinding(_binding);
> customBinding.Elements.Insert(0, new HttpCookieContainerBindingElement()); // Obsolete warning
> Binding binding = customBinding;
There is also a WinForms example in the test case. The code in the WinForms project also fails (On Mac with Mono) with the same error, and the workaround does not seem to work. The same WinForms project works fine on Windows with the AllowCookie setting.
I have checked this issue with 'Test Case' attached in comment 1 and able to reproduce this. To reproduce this issue I have followed the steps mentioned in bug description.
Screencast : http://screencast.com/t/QTX8ZoL0
Adb Logcat : https://gist.github.com/anonymous/139d99070b4b47c333d2
Note : I have checked this issue with device Samsung Galaxy Note 3( android version 4.4.2)
Environment Info :
=== Xamarin Studio ===
Version 5.2 (build 386)
Installation UUID: 011d70a5-dede-428b-ab04-ef451c2e539d
Mono 3.6.0 ((no/f540f8a)
GTK+ 2.24.23 (Raleigh theme)
Package version: 306000039
=== Xamarin.Android ===
Version: 4.14.0 (Enterprise Edition)
Android SDK: /Users/MM/Desktop/android-sdk-macosx
Supported Android versions:
2.1 (API level 7)
2.2 (API level 8)
2.3 (API level 10)
3.1 (API level 12)
3.2 (API level 13)
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: /usr
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-462-11M4609)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-462, mixed mode)
=== Apple Developer Tools ===
Xcode 5.1 (5084)
=== Xamarin.iOS ===
Version: 220.127.116.11 (Enterprise Edition)
Build date: 2014-08-01 15:27:48-0400
=== Xamarin.Mac ===
Version: 18.104.22.168 (Enterprise Edition)
=== Build Information ===
Release ID: 502000386
Git revision: e6a54dee5376e6e7a2d9982695b060fddc09e65d
Build date: 2014-08-04 14:03:28-04
Xamarin addins: 2b5a5c26ac2ee74c6e91a8d24ef44d0ca9cb74d0
=== Operating System ===
Mac OS X 10.9.2
Darwin MacMini.local 13.1.0 Darwin Kernel Version 13.1.0
Thu Jan 16 19:40:37 PST 2014
I suspect this is a duplicate of bug 11307.
I was able to reproduce the "Unable to set the CookieContainer" error on the current stable versions.
I then ran the test project on the current beta versions (that include the fix for bug 11307). I tested on an Android device and an Android emulator. In both cases the login completed without throwing the "Unable to set the CookieContainer" exception.
Instead, the alert dialog shows:
"Logged in True"
## Version information (beta channel)
*** This bug has been marked as a duplicate of bug 11307 ***
This bug was created because #11307 is marked as resolved. It is not resolved.
@Yuri, the test case attached to this bug and the test case attached to bug 11307 both run correctly for me on the current beta versions.
Unfortunately the "Resolved" status only indicates that a fix for a bug has been applied to the source code. Currently Xamarin's Bugzilla does not have a separate status to indicate that a fix for a bug has been released to the stable channel.
If you are able to reproduce the "Unable to set the CookieContainer" exception after upgrading to the beta channel using the test case attached to this bug report, be sure to let me know.
If, after upgrading to the beta channel, you are not able to reproduce the exception using the test case attached to this bug report, but you _are_ able to reproduce it with another app, the best next step would be to clean and zip up a sample project that demonstrates the problem, and then send it in to firstname.lastname@example.org, or attach it to a new bug report that includes the detailed steps to reproduce, actual results, expected results, and complete version information. (See also: https://bugzilla.xamarin.com/page.cgi?id=bug-writing.html)
Thanks in advance!