microsoft / SQLServerPSModule

This repo is the home of SQL Server PowerShell Module development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Write-SqlTableData gets TypeInitializationException with 22.1.1

KenRokos opened this issue · comments

I upgraded from 21.1.18256 to 22.1.1, and now Write-SqlTableData gets an error.

Write-SqlTableData : The type initializer for 'Microsoft.Data.SqlClient.InOutOfProcHelper' threw an exception.
At line:1 char:1
+ Write-SqlTableData @SQLServerArguments -TableName 'OperatorLogins' -I ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-SqlTableData], TypeInitializationException
    + FullyQualifiedErrorId : System.TypeInitializationException,Microsoft.SqlServer.Management.PowerShell.WriteSqlTableData

I also added -TrustServerCertificate to the command, but it fails the same way with or without that.

PowerShell version is 5.1.14393.5582. Running on Windows Server 2016 Standard. SQL Server is 2012, 11.0.7507 (SP4).

Hi @KenRokos - could you provide full(er) repro? What you have above is not enought to even guess.

Maybe when you run into this, capture $Error[0].Exception.ToString() and see if there's anything useful?