Skip to content

Instantly share code, notes, and snippets.

@EgorBo
Last active August 3, 2017 01:03
Show Gist options
  • Save EgorBo/e49bf46bffbcb9e2932c251c8221ba69 to your computer and use it in GitHub Desktop.
Save EgorBo/e49bf46bffbcb9e2932c251c8221ba69 to your computer and use it in GitHub Desktop.
bug.cs
using System;
using System.Data.SqlClient;
namespace sqldata
{
class MainClass
{
public static void Main(string[] args)
{
for (int i = 0; i < 200; i++)
{
var conn = new SqlConnection(@"Server=192.168.0.107\SQLEXPRESS;Database=testo;User Id=sa;Password=qwerty123;");
conn.Open();
Console.WriteLine(i);
GC.Collect(); //should close connection (but doesn't do it under mono)
}
Console.WriteLine("done");
//.NET 4.6 windows - OK
//.NET Core windows & macOS - OK
//MONO macOS - throws an exception at i=99 - no connections in the connection pool
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment