Bug 18534 - Get EngineEdition for SQL Server generate exception under Linux
Summary: Get EngineEdition for SQL Server generate exception under Linux
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Data (show other bugs)
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-03-22 06:27 UTC by Liviu
Modified: 2014-03-23 00:19 UTC (History)
2 users (show)

Tags:
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 18534 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:
Status:
NEW

Description Liviu 2014-03-22 06:27:25 UTC
Hi,

Using ADO.NET and trying to get the server edition it generate an exception on Mono under Linux environment.

Example:
using (var connection = new SqlConnection(connString))
{
    connection.Open();

    foreach (var cmdText in new[] {"select serverproperty('EngineEdition')", "SELECT 1"})
    {
        using (var command = new SqlCommand(cmdText, connection))
        {
            using (var reader = command.ExecuteReader())
            {
                reader.Read();
                Console.WriteLine(reader.GetInt32(0));
            }
        }
    }
}

Exception generated:
System.IO.IOException: Read failure ---> System.Exception: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond
  at System.Net.Sockets.Socket.Receive (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags) [0x0006b] in /build/buildd/mono-3-3.2.4/mcs/class/System/System.Net.Sockets/Socket.cs:1561
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00067] in /build/buildd/mono-3-3.2.4/mcs/class/System/System.Net.Sockets/NetworkStream.cs:378
  --- End of inner exception stack trace ---
  at System.Net.Sockets.NetworkStream.Read (System.Byte[] buffer, Int32 offset, Int32 size) [0x00078] in /build/buildd/mono-3-3.2.4/mcs/class/System/System.Net.Sockets/NetworkStream.cs:380
  at Mono.Data.Tds.Protocol.TdsComm.Read (System.Byte[] buffer, Int32 offset, Int32 count) [0x00000] in /build/buildd/mono-3-3.2.4/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/TdsComm.cs:611



First I noticed this behavior by using Entity Framework 6. I opened a discussion under EF Codeplex: https://entityframework.codeplex.com/discussions/538142

Because EF try to get SQL Version, at the begin of connection, this exception does not allow to be used in a Linux environment. There is a workaround for EF to avoid the issue (link above).

Anyway does not belong to EF and may be reproduced using the snippet above.

Thank you !

Liviu
Comment 1 Zoltan Varga 2014-03-23 00:19:27 UTC
-> System.Data.