If I have a method that, as I know, can potentially process endlessly, but I cannot reliably predict which conditions / parameters will trigger it, that is a good way in C # to do this:
try { PotentiallyInfiniteRecursiveMethod(); } catch (StackOverflowException) {
Obviously, you cannot do this in the main thread, but I have been told several times that this can be done using streams or AppDomain, but I have never seen a working example. Does anyone know how to do this reliably?
source share