Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GetSchema("DataType") is not compatible with Azure SQL Edge #2086

Closed
MaceWindu opened this issue Jul 7, 2023 · 3 comments · Fixed by #2099
Closed

GetSchema("DataType") is not compatible with Azure SQL Edge #2086

MaceWindu opened this issue Jul 7, 2023 · 3 comments · Fixed by #2099

Comments

@MaceWindu
Copy link
Contributor

Describe the bug

GetSchema('DataType") loads UDT types using CLR features of SQL Server, not supported on Azure SQL Edge leading to exception from server.

You can see that addUDTsToDataTypesTable method checks only SQL Server version here.

Unhandled exception: Common Language Runtime(CLR) is not enabled on this instance.
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
   at Microsoft.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
   at Microsoft.Data.SqlClient.SqlDataReader.Read()
   at Microsoft.Data.SqlClient.SqlMetaDataFactory.addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection connection, String ServerVersion)
   at Microsoft.Data.SqlClient.SqlMetaDataFactory.GetDataTypesTable(SqlConnection connection)
   at Microsoft.Data.SqlClient.SqlMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)
   at Microsoft.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)
   at Microsoft.Data.ProviderBase.DbConnectionInternal.GetSchema(DbConnectionFactory factory, DbConnectionPoolGroup poolGroup, DbConnection outerConnection, String collectionName, String[] restrictions)
   at Microsoft.Data.SqlClient.SqlConnection.GetSchema(String collectionName, String[] restrictionValues)
   at Microsoft.Data.SqlClient.SqlConnection.GetSchema(String collectionName)

To reproduce

connection.GetSchema("DataType")

Expected behavior

API doesn't try to access unsupported by server functionality.

Further technical details

Microsoft.Data.SqlClient version: 5.1.1

Additional context

Azure Edge unsupported features

Original issue : linq2db/linq2db#4195

@MaceWindu MaceWindu changed the title GetSchema("DataTypes") is not compatible with Azure SQL Edge GetSchema("DataType") is not compatible with Azure SQL Edge Jul 7, 2023
@JRahnama JRahnama added the 🆕 Triage Needed For new issues, not triaged yet. label Jul 7, 2023
@Kaur-Parminder
Copy link
Contributor

@MaceWindu I will look into it and report back.

@ErikEJ
Copy link
Contributor

ErikEJ commented Jul 8, 2023

@MaceWindu Does it work with Azure SQL database or is it same issue?

@MaceWindu
Copy link
Contributor Author

MaceWindu commented Jul 8, 2023

@ErikEJ , Azure SQL has own limitations, but this part works fine.

For Azure SQL we personally skip read of objects description from missing view sys.extended_properties, but it looks like SqlClient doesn't use it for schema API

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants