Eu estou com esse problema da mensagem, também cai no cálculo da chave. A mensagem é gerada apenas quando estou com o Delphi aberto. No cliente ele gera tudo normal e não apresenta a mensagem, mas mesmo assim ela me incomoda. Segue codigo do erro
function ValidarChave(const chave: string): boolean;
var
i: integer;
begin
result := false;
if (copy(chave, 1, 3) <> 'NFe') and (copy(chave, 1, 3) <> 'CTe') then
exit;
try
i := 0;
if GerarDigito(i, copy(chave, 4, 43)) then //erro aqui
result := i = StrToInt(chave[length(chave)]);
if result then
result := ValidarCodigoUF(StrToInt(copy(somenteNumeros(chave), 1, 2)));
if result then
result := ValidarAAMM(copy(somenteNumeros(chave), 3, 4));
if result then
result := ValidarCNPJ(copy(somenteNumeros(chave), 7, 14));
except
result := false;
end;
end;
Agradeço se alguém descobrir.
Obrigado