[Mono-bugs] [Bug 60038][Nor] New - NullReferenceException when passing null to SqlConnection or OracleConnection

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Fri, 11 Jun 2004 12:01:21 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by cmyers@austin.rr.com.

http://bugzilla.ximian.com/show_bug.cgi?id=60038

--- shadow/60038	2004-06-11 12:01:21.000000000 -0400
+++ shadow/60038.tmp.8656	2004-06-11 12:01:21.000000000 -0400
@@ -0,0 +1,42 @@
+Bug#: 60038
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: Windows XP SP1
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: cmyers@austin.rr.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: NullReferenceException when passing null to SqlConnection or OracleConnection
+
+Description of Problem:
+On MS.NET, if you pass null to the constructor of SqlConnection or 
+OracleConnection as the connection string,
+they will not throw an error until you attempt to open the connection. And 
+then you'll get an InvalidOperationException (I think).
+
+Also, if you pass a bogus connect string, they'll immediately throw an 
+exception telling you it's bogus.
+
+The SqlConnection and OracleConnection (and probably others) in Mono does 
+not properly handle a null connect string
+(it throws NullReferenceException instead of a more appropriate 
+ArgumentException or ArgumentNullException).
+
+Also, they do not throw an exception immediately when a bogus connect 
+string is passed in. Not until trying to open
+the connection do the Mono connection objects actually complain.
+
+I recommend at least throwing an ArgumentException when a null connect 
+string is passed.
+
+At most, to be consistent with MS.NET, parse the connect string in the 
+constructor if(!=null) and,
+if(==null) throw an exception during Open().