Forum Discussion
As a workaround, avoid inspecting the table variable using Alt+W or the Watch/Evaluate window during debugging. Instead, log specific values (e.g., Log.Message(t('col', 0))) or copy small subsets of the data into simple variables or arrays for inspection, since normal execution and TestExecute runs are not impacted.
From what’s been shared, this looks less like a data or scripting issue and more like a debugger-related problem on Windows 11. The crash only occurs when evaluating a populated table variable during a paused debug session, while the same code runs fine outside debug and on Windows 10. That strongly points to how TestComplete’s debugger is trying to evaluate or serialize the table object rather than how the data is being created or stored.
To help others reproduce and narrow this down, it would be useful to isolate the exact trigger by simplifying the scenario step by step: try a table with just one column and one row, then gradually increase columns and rows to see when it starts failing; check whether accessing a single cell versus evaluating the whole table makes a difference; and confirm whether the crash only happens when using Alt+W versus hovering or logging values. This should help determine whether the issue is tied to table size, structure, or the debugger’s evaluation behavior.
rraghvani
Please, what version of Windows are you using? I'm using Windows 11 Pro 24H2 edition.
Regarding the incorrect way we're using it, I discussed it internally and we couldn't agree that it's wrong, especially since we've been using this standard here for years, since we started automating the company, and we've never had this type of problem. We believe that if it were incorrect, it wouldn't have worked from the start.
We also tried to reproduce the scenario you described (we copied your code exactly) and we couldn't get it to work in either Windows 10 or Windows 11, which gave the same error. We tried another way but were unsuccessful, as it always presented a similar error.
We made changes and adjustments to work around the error and arrived at the code below. We also had to change the file extension to .xls, which prevented the print error, but we still couldn't inspect the variable via Alt+W. The same problem occurred: TestComplete froze and closed.
Note: This same code caused the problem in Windows 11, but I didn't have the problem in Windows 10 and the inspection went through normally.
function Test()
{
if (!Project.Variables.VariableExists("DadosPedidoComercial")) {
Project.Variables.AddVariable("DadosPedidoComercial", "Table");
}
var t = Project.Variables.VariableByName("DadosPedidoComercial");
if (t.ColumnCount == 0) {
t.AddColumn('nCdPedidoComercial');
t.AddColumn('nCdUsuarioResponsavel');
t.AddColumn('nCdEmpresa');
t.AddColumn('nCdModalidadeBoleto');
t.AddColumn('nPreco');
t.AddColumn('nQtde');
}t.RowCount = 0;
var row = 0;
var caminho = "C:\\Temp\\Book1.xls";
var nomeAba = "Dados";var excelDriver = DDT.ExcelDriver(caminho, nomeAba, true);
if (excelDriver != null) {
try {
while (!excelDriver.EOF())
{
t.RowCount = row + 1;
t.$set("nCdPedidoComercial", row, excelDriver.Value(0));
t.$set("nCdUsuarioResponsavel", row, excelDriver.Value(1));
t.$set("nCdEmpresa", row, excelDriver.Value(2));
t.$set("nCdModalidadeBoleto", row, excelDriver.Value(3));
t.$set("nPreco", row, excelDriver.Value(4));
t.$set("nQtde", row, excelDriver.Value(5));
row++;
excelDriver.Next();
}
} catch (e) {
Log.Error("Erro ao ler linha do Excel: " + e.message);
}
DDT.CloseDriver(excelDriver.Name);
} else {
Log.Error("Erro 'Sheet1$' detectado. Ação necessária: Abra o seu arquivo Excel e renomeie a aba de 'Sheet1' para 'Dados' e tente novamente.");
}if (t.RowCount > 0) {
Log.Message("Total de linhas importadas: " + t.RowCount);
}
}