Methods in reflected DLLs unable to be called. How can I get a better error message? Methods in reflected DLLs unable to be called. How can I get a better error message? powershell powershell

Methods in reflected DLLs unable to be called. How can I get a better error message?


According to this answer Run script from location that your dlls are copied and try this code:

$currentScriptDirectory = Get-Location[System.IO.Directory]::SetCurrentDirectory($currentScriptDirectory.Path)


This will give you exception details:

try{  [reflection.assembly]::LoadFile($dllLocation + 'MyNamespace.MyLibrary.dll')  $output = [MyNamespace.MyLibrary.MyClass]::CallMe()  Write-Host $output}catch [Exception]{  echo $_.Exception.GetType().FullName, $_.Exception.Message}