Forum Libraries, Components, and Plugins


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

System.Data.SqlClient InvalidOperationException only Mono?

This code works in Windows and not in Mac (System.Data.SqlClient)

Why is the environment decisive?

    var cb = new SqlConnectionStringBuilder();
            cb.DataSource = "...";
            cb.UserID = "...";
            cb.Password = "...";
            cb.InitialCatalog = "...";

            using (var connection = new SqlConnection(cb.ConnectionString))
                connection.Open(); ->** Exception here already**

With such a simple code I get

System.InvalidOperationException: Internal connection fatal error.

Specifically in TryRun

System.InvalidOperationException: Internal connection fatal error. at System.Data.SqlClient.TdsParser.TryRun (System.Data.SqlClient.RunBehavior runBehavior, System.Data.SqlClient.SqlCommand cmdHandler, System.Data.SqlClient.SqlDataReader dataStream, System.Data.SqlClient.BulkCopySimpleResultSet bulkCopyHandler, System.Data.SqlClient.TdsParserStateObject stateObj, System.Boolean& dataReady) [0x0015a] in /Users/builder/jenkins/workspace/build-package-osx-mono/2017-12/external/bockbuild/builds/mono-x64/external/corefx/src/System.Data.SqlClient/src/System/Data/SqlClient/TdsParser.cs:1599

In windows, no problem, I connect with Visual Studio in a console app.
In mac, with Visual studio I can`t (running console app or tests, etc.)

Version of SqlClient seems irrelevant and it happens with the latest 4.5.1

Do you know what I could be missing?


Sign In or Register to comment.