I developed a PowerShell module that relied on a .NET Assembly for some operations.
I refactored this module to not need that Assembly and noticed some strange behavior,
Apparently PowerShell will read the file and handle class-definitions before executing the code.
To solve this problem, the Add-Type
needs to be put into an own script file, which is run before the module loads (or in ISE, just run the code before running the class definitions).
This can be accomplished by using ScriptsToProcess from the PSD1 file.
Kudos to @TheIncorrigible1 for putting me on the track.