microsoft / microsoft/sqlmanagementobjects

Microsoft.Data.SqlClient is not supported on this platform

Ouverte
#149 11 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Langage dominant
C#
Étoiles
143
Forks
28
Métriques de merge des PR
Aucune PR mergée en 30 j

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par source/dbalight/cmdlets/public/ConnectServer.cs à la ligne 41, où ServerConnection est construit, et examinez le projet du module dbalight lié ainsi que son .csproj. Reproduisez l’échec sur la configuration M1 et .NET 6 signalée, puis déterminez si la configuration du projet ou la version de SQLManagementObjects provoque l’exception de plateforme de Microsoft.Data.SqlClient ; le travail est terminé lorsqu’une résolution vérifiée ou une incompatibilité documentée est établie.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, powershell, sql
Domaine
databases
Type d'issue
Bug
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.