I'm trying to profile an application but no matter what options I enable, it always throws an exception.
I can launch the debugger when the exception gets thrown and see why it is happening, but there is explanation for why it occurs.
My application is quite large, but the area it occurs in is small. The problem has arisen because a csv parser reads '3' in as 0.
This only happens in the profiler. It happens in debug and release. Changing the options seems to make it happen at different lines of the CSV file. I'm wondering if there is a strange interaction between garbage collection and profiling and something is being moved in memory while the profiler is doing something!
I'm running Windows 7 64 bit with 8gb RAM and a dual core processor. All the apps are .net 3.5
A string is read from the file. It is then passed to a method to create an object from that. The string is then passed to a csv parser for processing.
When I read the string in the debugger after the exception is thrown, I see it starts with '3;'. However when I check the value read from the first entry, I see '0'. I've put in console diagnostics and they show the same problem.
Changing various profiling options allows the program to run differing amounts!
My results: with the same version I get different results. This is, in a way, only to be expected- profiling using the "Instrumentation" technique does change the behaviour of code in various ways. Luckily- we have been working on "Sampling" mode in our new major version which is in Alpha testing at the moment and with this (on Windows 7) I get pretty much identical results.