cdbstack - last sample is dropped
The last sample in the file doesn't get added. So I added the following on line 119 of DebuggerStackSource.cs just after the end of the for(;;) loop. Just a copy/paste from the code above (including the sample.Metric = 1 per Issue 1009 - No metrics in cdbstacks).
if (stack.Count != 0)
{
StackSourceCallStackIndex parent = StackSourceCallStackIndex.Invalid;
for (int i = stack.Count - 1; i >= 0; --i)
{
parent = Interner.CallStackIntern(stack[i].frame, parent);
}
stack.Clear();
sample.Metric = 1;
sample.StackIndex = parent;
sample.TimeRelativeMSec = time;
time++;
AddSample(sample);
}
UPDATE: added the src file name
@wmascia can you share the data file where you saw this issue?
It would happen on any cdbstack file but you can use the one below. Granted you'd never actually care about this in a typical trace with bagillions of samples. I just happened to notice it when I had a small cdbstack file with an interesting frame in the last stack ...which I couldn't find in the stack viewer.
In this case A!foo and A!baz will be included but B!foo and B!baz will not.
test.cdbstack:
Call Site A!foo A!baz
Call Site B!foo B!baz
(Doh I mentioned the line number but not the src file in the OP. Just updated it)
Due to lack of recent activity, this issue has been labeled as 'stale'. It will be closed if no further activity occurs within 30 more days. Any new comment will remove the label.