A bug of JIT
Long time no update my blog Recently, one of our 32bit product experiences a weird crashing problem, the callstack shows crash happens during JITting a c# function. While if starting from debugger or disable JIT optimization from the config file, it works well. After experiments, we isolated the specific statements causing the crashing problem: 1: fixed(Point* pPoint = ...) 2: { 3: ... 4: pPoint[index] = GetPoint(); 5: ... 6: } The GetPoint is another c# function, returning a Point instance, which is a value type. And just JITting the above codes with optimization enabled will cause troubles. And one work-around is to rewrite with a temp variable first, then assign with the temp var. 1: Point thePoint = GetPoint(); 2: pPoints[index] = thePoint; Though seems to be strange, it works well. Sorry for not providing the callstack and debugging logs, since this happened one month ago, and I could not find detailed logs. Some other things ...