microsoft / microsoft/sqlmanagementobjects
Microsoft.Data.SqlClient is not supported on this platform
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 143
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
I've searched this repository along with the sqlclient repository. There are multiple issues bring this up but are either closed or solutions provided don't seem to fix the issue I'm getting.
I'm trying to create a basic binary module in PowerShell against SQL Server. I have a basic project structure with just one cmdlet so far (trying to see if this even works) that references SMO library.
Project: https://github.com/wsmelton/dbalight/tree/modulebuilder/source/dbalight
The project compiles for dotnet 6 on my M1 and the module imports with no issues. It is not until I call the Connect-DblServer:
Exception :
Type : System.PlatformNotSupportedException
TargetSite : Void .ctor()
Message : Microsoft.Data.SqlClient is not supported on this platform.
Source : Microsoft.Data.SqlClient
HResult : -2146233031
StackTrace :
at Microsoft.Data.SqlClient.SqlConnection..ctor()
at Microsoft.SqlServer.Management.Common.ConnectionManager..ctor(IRenewableToken token, Boolean removeIntegratedSecurity)
at Microsoft.SqlServer.Management.Common.ConnectionManager..ctor()
at Microsoft.SqlServer.Management.Common.ServerConnection..ctor()
at dbalight.cmdlets.general.ConnectServerCmdlet.ProcessRecord() in
/Users/smelton/git/dbalight/source/dbalight/cmdlets/public/ConnectServer.cs:line 41
at System.Management.Automation.Cmdlet.DoProcessRecord()
at System.Management.Automation.CommandProcessor.ProcessRecord()
CategoryInfo : NotSpecified: (:) [Connect-DblServer], PlatformNotSupportedException
FullyQualifiedErrorId : System.PlatformNotSupportedException,dbalight.cmdlets.general.ConnectServerCmdlet
InvocationInfo :
MyCommand : Connect-DblDblServer
ScriptLineNumber : 1
OffsetInLine : 1
HistoryId : 26
Line : Connect-DblServer -ServerInstance 'localhost,1432' -Verbose
PositionMessage : At line:1 char:1
+ Connect-DblServer -ServerInstance 'localhost,1432' -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InvocationName : Connect-DblServer
CommandOrigin : Internal
ScriptStackTrace : at <ScriptBlock>, <No file>: line 1
Line 41 of that cs file for the cmdlet is: ServerConnection srvCn = new ServerConnection();
- Is there something in my csproj that I have configured wrong?
- Is this just broken and I need to revert to an older version of the SQLManagementObjects library?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with source/dbalight/cmdlets/public/ConnectServer.cs at line 41, where ServerConnection is constructed, and inspect the linked dbalight module project and its .csproj. Reproduce the failure on the reported M1 and .NET 6 setup, then determine whether the project configuration or SQLManagementObjects version causes the Microsoft.Data.SqlClient platform exception; done means a verified resolution or a documented incompatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell, sql
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100