Rob, Rob Arthan wrote:
... You can use PolyML.exception_trace to produce a trace of exceptions that are not caught. Unlike the debugger this adds almost no overhead at run-time. You can then set explicit breakpoints where the exceptions are raised. I'll think about this but I think there may be problems with the interaction between the debugger and the low-level exception mechanism. ...
Unfortunately PolyML.exception_trace almost never gives me useful results. I think this maybe because I'm nearly always executing code via PolyML.compiler. Does that sound right? And is there a work-around?
The most likely reason is that the function that is raising the exception has been inserted inline into a calling function. This can happen through several levels so it may not be obvious which source function raised the exception. You can try reducing PolyML.Compiler.maxInlineSize and recompiling.
Another possibility, although unlikely, is that you have complex pattern matching on exceptions combining selection on exceptions and on their parameters. In that case the compiler may have had to insert a "catch-all" handler, discriminate the pattern using the general pattern matching code and reraise any unmatched exceptions. The exception trace will then show the exception as raised at the handler.
Regards, David.