SqlException with ADO.NET on Win2k3 SP1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application that has been in production for some time. I have a
coworker who recently updated to windows 2003 sp1. When he runs the
application he gets an exception here:

Exception StackTrace:
at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()

The exception SHOULD occur, because he isnt authorized for that SQL Server,
but what is troubling is that the exception should be handled. The code that
calls SqlConnection.Open() is wrapped in a try/catch block that catches all
sql exceptions. Still, we get the exception.

Now when he runs the application on my machine, which is windows 2003 server
without the service pack, it runs great. It only seems to occur on sp1. So, i
started to look into the issue and I noticed the assemblies had changed. So i
did an ILDASM and did a compare of the .il output and found the
SqlInternalConnection.UserCreateRequest() function had changed. Specifically,
it used to never throw an exception. Now it will throw an exception under
certain circumstances. This would be consistent with the exception that I am
now seeing in SP1 because ConnectionPool.GetConnection() calls this method.
Unfortunately, this is causing me issues.

What i really want to know is why my try/catch block isnt trapping the
exception. Instead its bubbling all the way up to
AppDomain.UnhandledException. I've seen this before with async callbacks and
threading, where if the exception is generated on a thread other than the one
that made the request it wont be transferred to the other thread, such as
getting an exception in a method called by ThreadPool.QueueUserWorkItem.

Does anyone have any ideas? Is this a known issue?

Thanks in advance.
 
What does your try ... catch look like?


---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Its quite a bit of code, but in a nutshell,

try
{
nested code leading up to SqlConnection.Open() within try... finally block
with finally doing the close.
}
catch (Exception ex) // So we can catch InvalidOperationExceptions due to
connection pool timeouts and SqlExceptions and unhandled exceptions from
above.
{
fire an event (i've verified that no consumers can throw exception during
execution)
}
finally
{
some work that just increments counters (cant throw exception)
}

Thanks for the response.
 
I was able to recreate this in a test application 100% of the time. Can I
email it to you? What is the best way to notify Microsoft of this issue?
 
Macromullet,
This newsgroup is one of the easiest ways to comunicate. I would be
interested in following up with you on this issue just reply without the
"online".

I would also like to encourage you to contact PSS directly, this would be
the best way to get a fix for this problem before the next service pack.

--
Angel Saenz-Badillos [MS] Managed Providers
This posting is provided "AS IS", with no warranties, and confers no
rights.Please do not send email directly to this alias.
This alias is for newsgroup purposes only.
I am now blogging about ADO.NET: http://weblogs.asp.net/angelsb/
 
Back
Top