Issue with PowerShell Module - SimplySql

Product: PowerShell Universal
Version: 1.4.6

I’m the module author for SimplySql (GitHub – mithrandyr/SimplySql) and one of my users is having issues using my module with PowerShell Universal. Their script works fine in a standard PS7 shell, but fails when trying to run as a job within PowerShell Universal.

SimplySQL within PowerShell Universal · mithrandyr/SimplySql · Discussion #148 (github.com)

I’ve roughly reproduced this users issue and the only provider within my module that has issues is the MySql provider – I’m using the MySqlConnector nuget package. Oracle, PostGres, MSSQL, SQLIte all work properly.

Here is the extracted error – it seems like a DLL couldn’t be loaded properly… but not sure why - the module is using Assembly Load Contexts (Resolving PowerShell module assembly dependency conflicts - PowerShell | Microsoft Learn).

Anyways, any assistance would be greatly appreciated.

1 Like

Within Universal it’s possible to choose which environment to use for the job. There’s the integrated one and, if available on the host, seperate environments for PS5.1 and 7.

Do you get the same error on all environments, or only the integrated one?

We do not use MySQL so I can’t speak to that, but to add to what ruben suggested… Minimal Environments would be something else to test. Minimal environments do not load most of the libraries that PSU would typically load and is suggested for scripts that use problematic modules.

Thanks for sharing the suggestion – I’ve passed it along to the user and hopefully this will resolve his or her issue.