Skip to content

A small utility to help hunt down SqlConnection objects that have not been returned to the pool

Notifications You must be signed in to change notification settings

BlueMountainCapital/SqlConnectionLeakTracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SqlConnectionLeakTracker

How to use:

  • Add a reference to SqlConnectionLeakTracker from your project.
  • Call SqlConnectionLeakTracker.SqlConnectionWrapper.PrintInstatiatedConnections or PrintOpenConnections at a point in your code where you would be interested in how many currently undisposed SqlConnection objects are around.
  • Run SqlConnectionLeakTracker on the assemblies that are instantiating/opening SqlConnections that are not being closed/disposed. E.g. SqlConnectionLeakTracker TestApp.exe This rewrites the IL in TestApp.exe to replace e.g. all calls to new SqlConnection() or IDisposable.Dispose() to go through a wrapper function that keeps track of SqlConnection objects.

Development:

  • There are some barebones tests--running TestApp.csproj will run runtest.bat which will run SqlConnectionLeakTracker on TestApp.exe, verify the executable, and test for some hard-coded expected output.
  • This uses Mono.Cecil to rewrite assemblies.
  • This could probably be expanded to look for any kind of undisposed IDisposable.
  • This does not currently have support for signed assemblies.

About

A small utility to help hunt down SqlConnection objects that have not been returned to the pool

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published