Skip to content

Commit eb46c58

Browse files
authored
Add | No-op if engineedition is 6 or 11 due to lack of support for ASSEMBLYPROPERTY function (#2593)
1 parent 8777fce commit eb46c58

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System;
6+
using System.Collections.Generic;
67
using System.Data;
78
using System.Data.Common;
89
using System.IO;
@@ -17,7 +18,7 @@ internal sealed class SqlMetaDataFactory : DbMetaDataFactory
1718

1819
private const string ServerVersionNormalized90 = "09.00.0000";
1920
private const string ServerVersionNormalized10 = "10.00.0000";
20-
21+
private readonly HashSet<int> _assemblyPropertyUnsupportedEngines = new() { 6, 9, 11 };
2122

2223
public SqlMetaDataFactory(Stream XMLStream,
2324
string serverVersion,
@@ -51,11 +52,13 @@ private void addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection con
5152

5253
SqlCommand engineEditionCommand = connection.CreateCommand();
5354
engineEditionCommand.CommandText = "SELECT SERVERPROPERTY('EngineEdition');";
54-
var engineEdition = (int)engineEditionCommand.ExecuteScalar()!;
55+
var engineEdition = (int)engineEditionCommand.ExecuteScalar();
5556

56-
if (engineEdition == 9)
57+
if (_assemblyPropertyUnsupportedEngines.Contains(engineEdition))
5758
{
58-
// Azure SQL Edge throws an exception when querying sys.assemblies
59+
// Azure SQL Edge (9) throws an exception when querying sys.assemblies
60+
// Azure Synapse Analytics (6) and Azure Synapse serverless SQL pool (11)
61+
// do not support ASSEMBLYPROPERTY
5962
return;
6063
}
6164

0 commit comments

Comments
 (0)