twice in GenerateReplacementString() you use the code:
Please note that the log10(0) is an error. When N is zero, skip is set to a large number. This causes a weird things including the IIS thread to die. I've added one line (twice) to fix this issue
log10((double)n) + 1;
Please include this fix in future version.