[Mono-dev] SqlConnection.Open - debugging for beginners? Advice Welcome!

Rob Wilkens robwilkens at gmail.com
Mon Apr 30 19:02:39 UTC 2012


I had a peak inside the System.Data.SqlClient.SqlConnection.Open source 
code in mono, I did _not_ have time to look extensively.  What i did 
notice that may be suspect, without finding precise details, is that 
connection pooling -may- be going on in there.  That is: the first time 
it fails to connect, it may be adding a connection to the 'pool', and 
somehow it may not be removing that connection from the pool when the 
login fails, and next time it tried to connect, it used a failed 
connection from the pool somehow (A connection which never was 
established) and under certain conditions this results in a failure.  
This is a guess and only based on a quick glance at the code, and not 
from debugging.

If i'm going to debug this myself....
What i need to do next, is refresh my memory on how to dump debug info 
to the console (i need the mono equivalent of a printf in c - i'm a fan 
of printf style debugging, i think there was a Console.out or something 
like that for my purposes that would work), plus figure out how to 
install a compiled mono installation to /usr/local (i've built it 
without installing it in a virtualbox virtual machine so i don't mess 
with my live installation).  I presume installing it to /usr/local will 
allow me to test without replacing any other mono that may be installed 
via packages, and also allow me to remove it from /usr/local to return 
to the packaged mono install somehow (again, it's a virtual machine set 
up just for this purpose, if it fails it's not the end of the world for me).

I'm not sure when I'll get to this.  It's not that i'm busy, i just have 
a short attention span.  I spent most of my time so far setting up the 
VirtualBox installation so i could play in a sandbox, less time has been 
spent browsing the code.

If anyone wants to chime in with a 'don't debug this yourself, let the 
experts do it' - please say so.  But i don't think i'm doing any harm 
playing with a local copy of the source which is all i have access to.

-Rob

> ------------------------------------------------------------------------
> *From:* Rob Wilkens <robwilkens at gmail.com>
> *To:* mono-devel-list at lists.ximian.com
> *Sent:* Friday, April 27, 2012 2:57 PM
> *Subject:* [Mono-dev] System.Data.SqlConnection fails on 2nd invalid 
> login attempt
>
> I probably shouldn't cross-post, but i wasn't sure where to put this, 
> or if i should file a bug report (I'm new-ish to mono).  After reading 
> the mailing list description, this seemed like a more appropriate 
> place to ask.
>
> First, let me say this is not a critical problem, and i'm not sure 
> whether it is a bug on mono or not.  I might be interested in trying 
> to fix this myself if i can figure out where to start (later), just as 
> a time waster project.
>
> When I create an SqlConnection called, say, MyConnection, and then 
> call MyConnection.Open() - the second time i call it (though the first 
> time with each new object it is called on) with an invalid login 
> name/password, it fails with what appears to be an exception message 
> that implies something was null when it shouldn't have been (object 
> reference not set to instance of an object).  If i call it with a 
> valid login name/password on any attempt, it doesn't raise any errors, 
> as is expected.
>
> From what i can tell, this is happening inside of MyConnection.Open() 
> ... and not in my code.  I've verified that MyConnection is not null 
> when i call Open().
>
> If you want to see sample code, i'll point you to my other post on 
> this topic:
> http://stackoverflow.com/questions/10355669/using-system-data-sqlconnection-in-mono-second-invalid-login-attempt-results-in 
>
>
> Does this sound like something i should file a bug on?  Also, if i'm 
> interested in contributing, would it be wisest to file a bug first, 
> then attempt to resolve it?
>
> -Rob
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com <mailto:Mono-devel-list at lists.ximian.com>
> http://lists.ximian.com/mailman/listinfo/mono-devel-list
>
>
>
>
> _______________________________________________
> Mono-devel-list mailing list
> Mono-devel-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-devel-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20120430/df5d9ea4/attachment.html>


More information about the Mono-devel-list mailing list