I have a method that calls an unmanaged library from a background thread. I put a try catch block around the unmanaged call but it is never caught. The just in time debugger catches it instead. What am I doing wrong?
public bool TurnOn()
{
var connectionSucceeded = false;
try
{
connectionSucceeded = turnOn(); //Unmanaged call
}
catch
{
connectionSucceeded = false; //Never reaches this block
}
return connectionSucceeded;
}