I have found an issue that is quite easy to reproduce. Please advise if there is any work around for this?
There are two .Net libraries libraryA.dll and libraryB.dll. And each library has one interface InterfaceA and InterfaceB. ClassAA implements InterfaceA and lives in libraryA. ClassAB implements InterfaceB and lives in the same libraryA. The same way ClassBB - LibraryB - InterfaceB; ClassBA - LibraryB - InterfaceA
New-Object works correctly when ClassAA and ClassBB are instantiated but not ClassAB or ClassBA. They constantly fail to instantiate.
Here you are powershell code
[System.Reflection.Assembly]::LoadFile(‘c:\LibraryA.dll’)
[System.Reflection.Assembly]::LoadFile(‘c:\LibraryB.dll’)
$obj1 = new-object -typeName ClassAA (IT WORKS)
$obj2 = new-object -typeName ClassBB (IT WORKS)
$obj3 = new-object -typeName ClassAB (EXCEPTION THROWN)
$obj4 = new-object -typeName ClassBA (EXCEPTION THROWN)
Many Thanks,
Andrey