What is the difference between debug mode and normal execution on dspic?
The difference between production and debug mode is normally twofold.

First, the compiler does different (read: better) optimizations in production mode. For example, removing code that might not be needed, pre-calculating constants, inlining function calls, unrolling loops and so on. In debug mode such optimizations might hinder debugging, since then a line-by-line stepping through the code might not be possible (because some lines might not have corresponding machine code after compilation anymore).

Second, the libraries that are used might run different code altogether. In debug mode there might be additional log output (unlikely on a MCU though). There might be additional sanity checks, e.g. for array boundaries or integer overflows. Even the memory layout of some structs might differ.
So when you see a problem in production mode, but not in debug mode, you have encountered a Heisenbug.

Since you say that your code is rather complex: can you reduce it to a minimal example that shows the behavior? Try get it down to the minimal number of tasks, then start adding them again. When you see the bug, you can limit the code area that causes that.

You can also look at the changes the debug might introduce. Disable optimization on the production build. Look at the FreeRTOS documentation what gets changed in debug mode, and try to work from there.

To check for resets: just toggle an otherwise unused pin right at the start of the program.