Bug 29823 - 4.0 Regression - SqlConnectionBuilder broken after migrating to System.Data reference source
Summary: 4.0 Regression - SqlConnectionBuilder broken after migrating to System.Data r...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data ()
Version: 4.0.0
Hardware: PC All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
: 30456 ()
Depends on:
Blocks:
 
Reported: 2015-05-07 05:04 UTC by Andrew Katz
Modified: 2015-06-30 03:00 UTC (History)
5 users (show)

Tags:
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 GitHub or Developer Community 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:
RESOLVED FIXED

Description Andrew Katz 2015-05-07 05:04:20 UTC
Prior to 4.0.0, System.Data.Common.DBConnectionStringBuilder.ShouldSerialize was NotImplemented and not called within the class itself.  Additionally, an in accurate commit into a derived class, System.Data.SqlClient.SqlConnectionStringBuilder was made for the ShouldSerialize method which instructed to NOT serialize password:

		[MonoNotSupported ("")] // Note that base.ShouldSerialize() is called but not implemented
		public override bool ShouldSerialize (string keyword)
		{
			if (!ContainsKey (keyword))
				return false;
			keyword = keyword.ToUpper ().Trim ();
			// Assuming passwords cannot be serialized.
			if (_keywords [keyword] == "Password")
				return false;
			return base.ShouldSerialize (_keywords [keyword]);
		}

This has no effect since it was never being called.  When the base class reference source was pulled in (https://github.com/mono/referencesource/blob/mono/System.Data/System/Data/Common/DbConnectionStringBuilder.cs), the call is now active, but incorrect.  You will see that Password should be serialized.  

PLEASE fix in 4.0.0 branch as you deem appropriate.

Reference Source: 

 public override bool ShouldSerialize(string keyword) {
            ADP.CheckArgumentNull(keyword, "keyword");
            Keywords index;
            return _keywords.TryGetValue(keyword, out index) && base.ShouldSerialize(_validKeywords[(int)index]);
        }
Comment 1 Marek Safar 2015-05-07 15:00:07 UTC
Fixed in master
Comment 2 Andrew Katz 2015-05-07 16:37:26 UTC
Thanks Marek.  Who/How does this get merged into the 4.0.0 branch?
Comment 3 Marek Safar 2015-05-08 03:14:09 UTC
It won't, you'll have to wait for mono 4.2 release
Comment 4 Marek Safar 2015-05-26 14:44:42 UTC
*** Bug 30456 has been marked as a duplicate of this bug. ***
Comment 5 Prashant manu 2015-06-30 03:00:58 UTC
We have checked with the sample attached in Bug 30456 and it is working fine with mono 4.3. Screencast: http://www.screencast.com/t/8KImYigK

Please let us know in case anything additional need to verify.

Environment Info:
Xamarin Studio
Version 5.10 (build 299)
Installation UUID: 642986ef-b668-4108-b6e5-f58c62d668b6
Runtime:
 Mono 4.3.0 (master/2221dfc)
 GTK+ 2.24.23 (Raleigh theme)

 Package version: 403000328

Xamarin.Profiler
Not Installed

Xamarin.Android
Version: 5.1.99.457 (Enterprise Edition)
Android SDK: /Users/360logica/Library/Developer/Xamarin/android-sdk-macosx
 Supported Android versions:
  2.3    (API level 10)
  4.0.3  (API level 15)
  4.4    (API level 19)
  4.4.87 (API level 20)
  5.0    (API level 21)
Java SDK: /usr
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)

Xamarin Android Player
Version: 0.3.4
Location: /Applications/Xamarin Android Player.app

Apple Developer Tools
Xcode 6.4 (7715)
Build 6E23

Xamarin.iOS
Version: 8.11.0.1164 (Enterprise Edition)
Hash: dc19d0a
Branch: master
Build date: 2015-06-29 18:38:43-0400

Xamarin.Mac
Version: 2.1.0.1164 (Enterprise Edition)

Build Information
Release ID: 510000299
Git revision: a8391331ee54468fe238fa07a423b3b6ad229384
Build date: 2015-06-30 00:20:43-04
Xamarin addins: 1618e0996a5a331aa00d13d9d528f667a3e7912e
Build lane: monodevelop-lion-master

Operating System
Mac OS X 10.10.0
Darwin 360Logicas-MacBook-Pro.local 14.0.0 Darwin Kernel Version 14.0.0
    Fri Sep 19 00:26:44 PDT 2014
    root:xnu-2782.1.97~2/RELEASE_X86_64 x86_64