I created a solution with Console App(.NET Framework) as the Server (net.tcp://0.0.0.0:8000/server) and WPF App(.NET Framework) as the client. There's an array with few names in that server and a method to search by index. From WPF client user can search names by index and it display the name. I created a FaultException to throw if client requested index is out of the bound the array. And It is also handled in the WPF client. But the app crashes if the index is out of bound.
Server
public void Search(int index, out string name){
if (index >= 0 && index < array.Length)
{
name = array[index];
}
else
{
throw new FaultException<SearchFault>(new SearchFault() { Message = "Not Found"});
}
}
WPF Client
private void SBtn_Click(object sender, RoutedEventArgs e)
{
int index = int.Parse(indexBox.Text) //This convertion exceptions are also handled. (I wont show here)
string name = "";
try
{
serverIntf.Search(index, out string name);
nameBox.Text = name;
}
catch (FaultException<SearchFault> ex)
{
Console.WriteLine(ex.Message);
}
}
Everything Tried, But Nothing worked. Can anyone help me with this :(

