Skip to content

Commit 80905bd

Browse files
authored
Skip UDT query on Azure SQL Edge (#2099)
fixes #2086
1 parent 3c83f6c commit 80905bd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Microsoft.Data.SqlClient/src/Microsoft/Data/SqlClient/SqlMetadataFactory.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,16 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con
4949
return;
5050
}
5151

52+
SqlCommand engineEditionCommand = connection.CreateCommand();
53+
engineEditionCommand.CommandText = "SELECT SERVERPROPERTY('EngineEdition');";
54+
var engineEdition = (int)engineEditionCommand.ExecuteScalar()!;
55+
56+
if (engineEdition == 9)
57+
{
58+
// Azure SQL Edge throws an exception when querying sys.assemblies
59+
return;
60+
}
61+
5262
// Execute the SELECT statement
5363
SqlCommand command = connection.CreateCommand();
5464
command.CommandText = sqlCommand;

0 commit comments

Comments
 (0)