# Error: Multiple ambiguous overloads found for "Find" and the argument count: "1"

**URL:** <https://forums.powershell.org/t/error-multiple-ambiguous-overloads-found-for-find-and-the-argument-count-1/5248>\
**Category:** PowerShell Help\
**Created:** [November 22, 2015, 7:18pm UTC](https://forums.powershell.org/t/error-multiple-ambiguous-overloads-found-for-find-and-the-argument-count-1/5248 "2015-11-22T19:18:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shuchi](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@shuchi](https://forums.powershell.org/u/shuchi)\
**Post date:** [November 22, 2015, 7:18pm UTC](https://forums.powershell.org/t/error-multiple-ambiguous-overloads-found-for-find-and-the-argument-count-1/5248/1 "2015-11-22T19:18:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [November 23, 2015, 12:01am UTC](https://forums.powershell.org/t/error-multiple-ambiguous-overloads-found-for-find-and-the-argument-count-1/5248/2 "2015-11-23T00:01:13Z")

</div>

These two parts of your class definition look ambiguous to me. I wasn’t aware that C# would even allow this to compile:

```
public Control Find(string path) {..}
public Control Find(string path, bool recog = true) {..}
```

As a workaround in PowerShell, I’d probably just call the second overload by explicitly specifying the boolean parameter’s default value: $facade.Find($cPath, $true)

---

<div class="post-metadata">

**Author:** ![shuchi](https://avatars.discourse-cdn.com/v4/letter/s/7feea3/32.png) [@shuchi](https://forums.powershell.org/u/shuchi)\
**Post date:** [November 30, 2015, 9:06pm UTC](https://forums.powershell.org/t/error-multiple-ambiguous-overloads-found-for-find-and-the-argument-count-1/5248/3 "2015-11-30T21:06:28Z")

</div>

Thanks for answering

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:43pm UTC](https://forums.powershell.org/t/error-multiple-ambiguous-overloads-found-for-find-and-the-argument-count-1/5248/4 "2024-05-16T20:43:30Z")

</div>

Closed on May 16, 2024, 8:43pm UTC


