简体   繁体   English

使用特定字符串时,Google Apps 脚本调试器挂起

[英]Google Apps Script debugger hangs when working with a specific string

I've run into a very peculiar bug and can't quite figure out what's wrong with it.我遇到了一个非常奇怪的错误,无法弄清楚它有什么问题。

Here's the code that reproduces this issue:这是重现此问题的代码:

function testDoubleQuote() {
  var xmlString = '<file><text>Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. &lt;br /&gt;&lt;br /&gt;Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.</text></file>';
  var xml = XmlService.parse(xmlString);
  var content = xml.getAllContent();
  var text = content[0].getValue();
  console.log(text);
}

GAS hangs on the line with getValue(); GAS 挂在线上用 getValue(); Other attempts to get the text don't seem to work as well.其他获取文本的尝试似乎也不起作用。 However, if I manually remove from the string either ï, “ or ” it seems to work.但是,如果我手动从字符串中删除 ï、“ 或 ”,它似乎可以工作。 If I remove any two characters, it works again.如果我删除任何两个字符,它会再次起作用。 What's going on?这是怎么回事? Is there a character limit to the string?字符串有字符限制吗? Something else at work?其他工作? The debugger just hangs.调试器只是挂起。

A script I wrote to make a Javascript object from the XML object after parsing "works" in the sense that it creates the object. A script I wrote to make a Javascript object from the XML object after parsing "works" in the sense that it creates the object. However, when attempting to view the text content of the object,the debugger never stops loading it.但是,当尝试查看 object 的文本内容时,调试器永远不会停止加载它。 When I go through the process step by step, it hangs on getValue() or getText() or getChildText(name) when getting that specific text value.当我 go 逐步完成该过程时,它在获取特定文本值时挂在 getValue() 或 getText() 或 getChildText(name) 上。 I guess it creates it because GAS largely runs asynchronously and the functions for those specific values just never return but that's for some reason ignored.我猜它创建它是因为 GAS 在很大程度上是异步运行的,并且这些特定值的函数永远不会返回,但由于某种原因被忽略了。

I can't seem to get any more info from GAS on what's going on.我似乎无法从 GAS 获得更多关于正在发生的事情的信息。 Is this caused by XmlService.parse()?这是由 XmlService.parse() 引起的吗?

function testDoubleQuote() {
  var xmlString = '<file><text>Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. &lt;br /&gt;&lt;br /&gt;Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.</text></file>';
  var xml = XmlService.parse(xmlString);
  var content = xml.getAllContent();
  //Logger.log(content.length);
  var text = content[0].getValue();
  Logger.log(text);
}

Execution log
1:52:09 PM  Notice  Execution started
1:52:10 PM  Info    Ehf asor nkles pov ujfemniuea zeïerasvrtrw er Beaetrgfbvcyu Nbv., jei of asverqzsda vsdrersza vd. <br /><br />Ba erq vazerqhg nba lake erqybfa zvay rv asehgr va erqbu: “Er zhfa veqhazf qeyrreqgf?” Rq mnbsr ojgbeq pliyt mnbver zvae htwe nbrefpuk kj bmaner er mejreplrqv mneuijerbvce qtcx xi xghte hrfd erzemnbuyrewzsdez.
1:52:10 PM  Notice  Execution completed

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM