Bug 27546 - OracleConnection pooling problem
Summary: OracleConnection pooling problem
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data ()
Version: 3.12.0
Hardware: PC Windows
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-03-02 07:11 UTC by JOP
Modified: 2015-09-18 04:33 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 27546 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description JOP 2015-03-02 07:11:46 UTC
When trying to connect to Oracle database using pooling, I get Unhandled Exception when the program terminates. 

callstack for this error:
Cannot cast from source type to destination type.
  at System.Data.OracleClient.OracleConnectionPoolManager.Dispose () [0x00000] in <filename unknown>:0 
  at System.Data.OracleClient.OracleConnectionPoolManager.Finalize () [0x00000] in <filename unknown>:0

There is quite easy way how to simulate this bug: (this code is almost ctrl+c, ctrl+v from sample how to connect to oracle using mono)
string connectionString = "User ID=xxxx;Data Source=yyyy;password=zzzz;Pooling=true;Min Pool Size=1;Max Pool Size=10";
  using (OracleConnection dbcon = new OracleConnection(connectionString))
  	OracleCommand dbcmd = dbcon.CreateCommand();
  	string sql = "SELECT 1 FROM dual";
  	dbcmd.CommandText = sql;
  	OracleDataReader reader = dbcmd.ExecuteReader();
  	while (reader.Read())
  	// clean up
  	reader = null;
  	dbcmd = null;
  Console.WriteLine("Test");          //this gets printed to console

I managed to simulate this bug either on windows and linux distribution of mono. The error happens all the time. The error does not happen, if I don't use pooling in connection string.
Comment 1 Tatan Sugiana 2015-09-18 04:33:38 UTC
same here, using mono 4.0.4 got the same behaviour