microsoft / microsoft/sqlmanagementobjects

Microsoft.Data.SqlClient is not supported on this platform

Abierto
#149 11 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Lenguaje dominante
C#
Estrellas
143
Forks
28
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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?

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con source/dbalight/cmdlets/public/ConnectServer.cs en la línea 41, donde se construye ServerConnection, e inspecciona el proyecto del módulo dbalight vinculado y su .csproj. Reproduce el fallo en la configuración M1 y .NET 6 indicada y determina si la configuración del proyecto o la versión de SQLManagementObjects causa la excepción de plataforma de Microsoft.Data.SqlClient; el trabajo estará terminado cuando haya una resolución verificada o una incompatibilidad documentada.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
csharp, powershell, sql
Área
databases
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Necesita aclaración
Aptitud para principiantes
25/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.