Repository navigation
Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels
Activity
[-]GetSchema("DataTypes") is not compatible with Azure SQL Edge[/-][+]GetSchema("DataType") is not compatible with Azure SQL Edge[/+]Kaur-Parminder commentedon Jul 8, 2023
@MaceWindu I will look into it and report back.
ErikEJ commentedon Jul 8, 2023
@MaceWindu Does it work with Azure SQL database or is it same issue?
MaceWindu commentedon 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
Skip UDT query on Azure SQL Edge
Skip UDT query on Azure SQL Edge (#2099)