Question

I am using Visual Studio 2003 with .NET 1.1 (Visual basic) - yes it is a legacy system and cant be upgraded. There is a workflow in this program which runs for 25 minutes to complete (basically to print checks using active reports). Now suddenly for one of the clients, process fails after 20 or more minutes throwing a null reference exception. I am putting the error box as below - enter image description here

when I click on break, it says source could not be found on this location

enter image description here

Now the issue is this process runs for 100's of employee with calls to 10s of functions and I cant really keep putting breakpoints to debug for each of the employee (it would simply take hours) to see where it is throwing the null error. I could also not wrap all the objects in try catch or null check (it just involves way too many files and functions to do that) I need to know where it is breaking!

I also monitored the memory on task manager to see if aspnet is eating too much memory - but it seems to be always under 120MB. I tried GC.Collect() as well - but no help.

I would appreciate if someone could guide me on how to debug this issue?

Thanks

Was it helpful?

Solution

Add some old school Console.WriteLine("I'am working on Employee nr: " + empNo) to pinpoint where you get the exception. Now you can set a conditional breakpoint on that value and start your debug session. Also, sometime, simply looking at the database tables involved reveals the problem (some field is null)

OTHER TIPS

Try to catch the exceptions on an app domain level and log the stack trace to see where it occurs. You can only show the source if the PDBs for the location where the exception occurs are available.

You can find more information here

Edit (more Info): It basically allows you to catch every exception that is not handled in one Method. Try to write the exception messages and their stack traces to a log file. It would be best to cycle recursively through the InnerExceptions to really get to the source of the error. After you have found it you can manually debug it, because you'd know where to set breakpoints.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top