简体   繁体   English

其他人能否在Dart调试器/编辑器中重现此错误?

[英]Can anyone else reproduce this bug in the Dart debugger/editor?

For my sanity, can someone verify a strange bug I'm having with the dart editor? 为了我的理智,有人可以验证我在Dart编辑器中遇到的奇怪错误吗?

I'm using the latest dart editor from the main page of the website, I downloaded, extracted, then ran the "DartEditor" executable. 我正在使用网站主页上的最新dart编辑器,我已下载,提取并运行了“ DartEditor”可执行文件。 (I didn't clear any previous settings that were stored elsewhere, but I don't think that will change the issue.) (我没有清除存储在其他位置的任何先前设置,但我认为这不会改变问题。)

Dart Editor version 1.0.0_r30798 (STABLE)
Dart SDK version 1.0.0.10_r30798
  • Download my repository: https://github.com/Naddiseo/dart-sprintf.git 下载我的存储库: https : //github.com/Naddiseo/dart-sprintf.git
  • Switch to the debugger_ide_test branch 切换到debugger_ide_test分支
  • On console (not in the editor) run dart test/sprintf_test.dart The output should be: 在控制台上(不在编辑器中)运行dart test/sprintf_test.dart输出应为:

    decimal=1, exp=0, digits=[5, 4, 6, 6]

  • Next, fire up the editor, and open the folder. 接下来,启动编辑器,然后打开文件夹。

  • Run the same file, and it should print out the same result. 运行相同的文件,它应该打印出相同的结果。
  • Now for the weird part. 现在开始怪异的部分。 Set a break point in lib/src/formatters/float_formatter.dart:17 which is the first line of the constructor. 在lib / src / formatters / float_formatter.dart:17中设置一个断点,这是构造函数的第一行。
  • Run the test file in the editor again then continue once it gets the break point. 再次在编辑器中运行测试文件,然后在到达断点后继续。

With the breakpoint I'm getting the following output: 使用断点,我得到以下输出:

decimal=1, exp=0, digits=[0, 0, 5, 4, 6, 6]

I've attributed it to the List<String> constructor, which seems to initialise to not be empty. 我将其归因于List<String>构造函数,该构造函数似乎初始化为非空。

Does anyone else get this problem? 还有其他人遇到这个问题吗? I've tried to condense this into a testable single file, but have failed to reproduce; 我试图将其压缩到一个可测试的单个文件中,但是未能重现。 I'm only able to reproduce it in the actual project. 我只能在实际项目中复制它。

Definitely sounds like a bug. 绝对听起来像是个错误。 As Fox32 suggests, please file a bug on http://dartbug.com/new . 如Fox32所建议,请在http://dartbug.com/new上提交错误。

Generally these kind of bugs happen for two reasons: 通常,此类错误的发生有两个原因:

  • The debugger has a side-effect: if the debugger (here the Dart-editor) invokes the actual toString method on visible variables, it could have a side-effect. 调试器具有副作用:如果调试器(在这里是Dart编辑器)对可见变量调用实际的toString方法,则可能会有副作用。 Most commonly this happens to Iterable s that have a side-effect. 最常见的情况是发生在具有副作用的Iterable
  • The VM has a bug when debugging. 调试时,VM有错误。 The VM has to compile code differently (for example disable some optimizations) to stop at any arbitrary location. VM必须以不同的方式编译代码(例如,禁用某些优化)以停止在任意位置。 It could be that your breakpoint triggers a bug there. 可能是您的断点在那里触发了一个错误。

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

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