dsccommunity / SqlServerDsc

This module contains DSC resources for deployment and configuration of Microsoft SQL Server.
MIT License
360 stars 227 forks source link

SqlReplication: Throws exception when used with SQL Server 2022 #1801

Closed johlju closed 1 year ago

johlju commented 2 years ago

Problem description

When running the integration tests for SqlServiceAccount, on the build worker that have installed the SQL Server 2022 of the Database Engine, it fails with an exception. It seems it fails when getting the current state.

To reproduce, enable the Pester tag 'Integration_SQL2022' on line 39 in the integration tests of SqlReplication and then run the pipeline (or the integration test).

Verbose logs

##[error]    [-] Should compile and apply the MOF without throwing 1.82s (1.81s|9ms)
##[error]     Expected no exception to be thrown, but an exception "Could not load file or assembly 'Microsoft.SqlServer.ConnectionInfo, Version=16.200.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified." was thrown from D:\a\1\s\tests\Integration\DSC_SqlReplication.Integration.Tests.ps1:109 char:17
##[error]         + ...               Start-DscConfiguration @startDscConfigurationParameters
##[error]         +                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.
##[error]     at } | Should -Not -Throw, D:\a\1\s\tests\Integration\DSC_SqlReplication.Integration.Tests.ps1:110

DSC configuration

See integration tests configuration.

Suggested solution

Unknown. But seems this assembly is not loaded by the powershell module SqlServer and no longer added to GAC by SQL Server setup. Try to move to latest version of the PowerShell module SqlServer and try to load it correctly (see issue #1352) 🤔

SQL Server edition and version

SQL Server 2022 (GA)

SQL Server PowerShell modules

SqlServer 21.1.18256 (as installed by integratation tests)

Operating system

Windows Server 2019 and Windows Server 2022

PowerShell version

Unknown (the version build pipeline uses)

SqlServerDsc version

Code in main branch.
johlju commented 1 year ago

This was resolved with PR #1808. To use this resource on SQL Server 2022 the SqlServer module 22.0.49-preview is needed, and also the latest preview of SqlServerDsc (building and deploying as I write this).