Try using debug version and where it crashes you will be taken to the code and see if any values are not as accepted and that should be the best way to go.

If it does not crash in debug mode then you should be going about using the outputdebugstring or write the log to a file with the possible variables that can cause the trouble and find out the problem.