Issues with importing internal module that uses Add-Type


We are having issues with importing one of our internal modules in the context of PSU.
My colleague had an issue with API endpoint, for me it fails when I have it in roles.ps1.

I see following information in the log:

2020-12-15T14:51:28.2678878+01:00 0HM510023AUF6:00000001 [ERR] 
The 'Get-OPGroupSid' command was found in the module 'ServerFunctions', but the module could not be loaded. For more information, run 'Import-Module ServerFunctions'.
at <ScriptBlock>, <No file>: line 6 (b20d7f6a)

Module works fine if we comment out parts of the code, but that is not ideal. The part that we had to comment out involves Add-Type:

Add-Type -LiteralPath $PSScriptRoot\NetUtils.cs -ErrorAction Stop
Add-Type -LiteralPath $PSScriptRoot\TimeZone.cs -ErrorAction Stop

Is there something in PSU that intentionally makes that sort of code injection failing? Can we work around that somehow?

Product: PowerShell Universal
Version: 1.5.6

I don’t know why that wouldn’t work. Let me give it a shot.