question

phaniSastry-1647 avatar image
0 Votes"
phaniSastry-1647 asked phaniSastry-1647 answered

Microsoft.SqlServer.Management.Smo --> SmoApplication.EnumAvailableSqlServers(false) throws error

Hi.

have developing an App in .net 6.0 framework for which need to enumerate sql server instances available in the network domain. When calling below code

added nuget packages Microsoft.SqlServer.Management objects

System.Data.SqlClient,

Microsoft.Windows.Compatibility

Microsoft.SqlServer.Management.Smo --> SmoApplication.EnumAvailableSqlServers(false) throws following error

could not instantiate object Microsoft.SqlServer.Management.Smo.AvailableSQLServers.

at Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.CreateObjectInstance(Assembly assembly, String objectType)

at Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.CreateObjectInstance(String assemblyName, String objectType)

at Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.LoadElement(ObjectLoadInfo oli)

at Microsoft.SqlServer.Management.Sdk.Sfc.ObjectCache.LoadFirstElementVersionless(Urn urn, Object ci)

at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetServerVersion(Urn urn, Object ci)

at Microsoft.SqlServer.Management.Sdk.Sfc.Environment.GetObjectInfo(Object ci, RequestObjectInfo req)

at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetObjectInfo(Object connectionInfo, RequestObjectInfo requestObjectInfo)

at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.FixPropertyList(Object connectionInfo, Urn urn, String[] fields, RequestFieldsTypes requestFieldsType)

at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.GetData(Object connectionInfo, Request request)

at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.Process(Object connectionInfo, Request request)

Same code works fine in framework 4.8.

Can some one give pointers?

Regards,

Phani.

sql-server-generaldotnet-standard
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

pituach avatar image
0 Votes"
pituach answered phaniSastry-1647 commented

hi,

could not instantiate object Microsoft.SqlServer.Management.Smo.AvailableSQLServers.

Please check if the following discussion solve your issue:

https://github.com/microsoft/sqltoolsservice/issues/890


· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

we need to populate all the servers in network domain, this doesnt seem to work for me.

0 Votes 0 ·
phaniSastry-1647 avatar image
0 Votes"
phaniSastry-1647 answered

we need to populate all the servers in network domain, this doesnt seem to work for me.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Robertocrtv avatar image
0 Votes"
Robertocrtv answered

Hi! Have you solved this problem?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

phaniSastry-1647 avatar image
0 Votes"
phaniSastry-1647 answered

No. the problem is not solved

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.