Getting following exception while invoking C# functions from PowerShell 4.
Multiple ambiguous overloads found for “Find” and the argument count: “1”.
At D:\Test\sample2.ps1:19 char:1
- $ctrl= $facade.Find([string]$cpath)
The PowerShell script used is as follows:
$fileDirectory = “D:\Test\runtime”;
foreach($file in Get-ChildItem $fileDirectory)
{
$filePath = $fileDirectory + "" + $file;
if ($file.Extension -like ‘.dll’)
{
Add-Type -Path $filePath
}
}
$facade = New-Object FullNamespace.Facade -argumentlist "D:\App.xml , $True
[string]$cpath = “App.Home.Logo”
$ctrl= $facade.Find([string]$cpath)
The definition of my C# class is as follows:
public class Facade
{
public Facade(string xMLPath, bool wait = false) {…}
public Control Find(string path, string id, string name) {…}
public Control Find(string path) {…}
public Control Find(string path, bool recog = true) {…}
}
Any help, pointers to resolve the error will be appreciated.