Can anyone else reproduce this bug in the Dart debugger/editor? - dart

For my sanity, can someone verify a strange bug I'm having with the dart editor?
I'm using the latest dart editor from the main page of the website, I downloaded, extracted, then ran the "DartEditor" executable. (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
Switch to the debugger_ide_test branch
On console (not in the editor) run dart test/sprintf_test.dart The output should be:
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.
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.
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.
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. Most commonly this happens to Iterables that have a side-effect.
The VM has a bug when debugging. The VM has to compile code differently (for example disable some optimizations) to stop at any arbitrary location. It could be that your breakpoint triggers a bug there.

Related

Unable to Build mac project in XCode14.0/14.1 with macOS ventura

I have recently updated to macOS 13.0 and for that minimum XCode Version required is 14.x series. But my existing project never getting successfully building. Its getting stuck at some point.
Its not getting failed. Build process screenshot is attached below. Its not pointing to any specific class. Seems like there are lots of classes which are getting compiled successfully at last but still build process is stuck at some point:
Seen similar threads like below on apple pages but nothing seems working. Does anyone got resolution?
Xcode 14 project compile error
XCode 14 compile errors immediately disappear or do not appear at all
Something similar has happened to me in the past on a number of occasions. If the Swift compiler is hanging mid-build, usually the issue is that there is some expression that is too complex for Swift to do the type inference on.
What you need to do is first find the exact statement that is causing the hang. This is how I do it:
First find out which source file is causing the problem. Look at the build log to figure this out (the build log can be located by looking at the reports navigator ⌘9 ). Find the build log and click on it. The build log will appear in an editor window.
One of the compiles will still be in progress and its file is the one you want.
The next thing to do is comment out all the code and recompile. This time the compilation will finish (if you have the right file, or there is only one) but probably with a lot of errors. Then you add the code back in, function by function, until one of them causes the compilation to hang again. If it's not obvious which line of the function is causing the problem, comment it out again and then add the lines back one by one until the compilation breaks again.
Once you have located the line, you need to simplify the type inference on that line. If it's a closure, try adding an explicit declaration for its parameters and return type. If it involves some complex array, try adding a type annotation to its declaration. Also try breaking down complex expressions into multiple simpler expressions.
There's no one size fits all answer to this but usually, once you have located the exact line that is causing the problem, it should be reasonably obvious how to fix it.

F# build error: "No compiled representation for provided namespace"

Has anyone run into this error message before? Google found it for me in the source code (https://github.com/fsharp/fsharp/blob/master/src/fsharp/tast.fs), but I haven't the slightest idea what is causing it.
This started happening when I tried to upgrade my library project from .NET 5 to .NET 6, so the real answer to my question may be an explanation of what I did wrong there. All I did was the following:
In the fsproj, changed "TargetFramework" from "net5.0" to "net6.0"
In my paket.dependencies file, changed "framework" from "net5.0" to "net6.0". (I've also tried commenting out the "framework" line.)
Then after running "paket update" and "dotnet build" I get the obscure error. ("error FS0192 : internal error : No compiled representation for provided namespace")
UPDATE: After some laborious code commenting/uncommenting, etc., I believe I've narrowed this down to my code's use of the Fable.RegexProvider assembly. (I use the SafeRegex component.) RegexProvider hasn't been updated in a couple years. I'll alert the folks over there to this issue, and I'll post an update here if/when I learn anything. (In case anybody else runs into this.)
In case anyone else runs into this, here is the solution (which is the solution #CaringDev recommended above, though it only works for Fable 3.7.18 and after):
When I raised this issue on the Fable.RegexProvider github (see thread here: https://github.com/fable-compiler/Fable.RegexProvider/issues/9), the initial thought was to try a .NET 6 build of Fable.RegexProvider. But then Alfonso Garcia-Caro realized that subsequent improvements to Fable may have obviated the need for SafeRegex.
He ultimately needed to tweak something in Fable, but as of version 3.7.18, the Fable transpiler supports the use of FSharp.Text.RegexProvider, such that Fable.RegexProvider is now unnecessary.

Angular dart on WebStorm. Debug is no more working

It is a week now that I have problems debugging angular dart applications in WebStorm. If I use debug on a console (server) application everything works fine.
I tried to roll back to angular 4.0.0 (on dart 1.24.3), but this didn't help.
I really don't know what kind of info could be useful.
Please, let me know if there is some configuration file that I can print or that could be important in order to fix the problem. I tested a lot of configurations, but, at present, I'm not able to work properly. After filling up my code with print statements, there are some cases where also this practice is not enough.
Edit1:
I have tried to create a sample project. With no DDc and target chrome, the debugger stops but not on all breakpoints. With no DDc and target Dartium, it does not stop.
Edit 2:
I was running my application with target dartium, because with target chrome I had an annoying error that I was not able to catch. Now I got it, and running the project with target chrome, revives the debugger. This is a good new. Just a question, is a problem of release 1.24.3 (Dartium has not been released for this release) or something else? Anyway, if this is a known problem, it wouldn't be better to disable the target dartium on WebStorm when the release is 1.24.3?
Edit 3:
Now the debugger is working, but only on the project you are developing. The imported packages are not stopping on breakpoints. As my project is divided in a lot of packages, I cannot debug approximately 80% of my code.
Am I doing something wrong?
What you are hitting here isn't functionality directly in an Angular Dart or Dart issue, but in the JS Debugger in WebStorm.
Open an issue on YouTrack here: https://youtrack.jetbrains.com/issues
Include not only the version of Angular and the Dart SDK, but also the version of WebStorm, and an example of where breakpoints are not working.
Finally, there is some information in this issue that might help: https://youtrack.jetbrains.com/issue/WEB-30593

DirectiveProcessor failed with errors on files in PaxHeader directory on Windows

I have an application that is part Polymer Dart and part AngularDart 2, and I'm getting a large string of errors when I attempt to do a pub get. The errors I'm getting look like this:
[DirectiveProcessor]:
Failed with 27 errors
Error 1: line 1, column 1 of lib\common\PaxHeader\service.dart and parts: Expected a method, getter, setter or operator declaration
17 gid=234561557
^^
My Angular dependency is set in my pubspec.yaml as angular2: "2.0.0-beta.22" and I am running Dart 1.19.0 on Windows 7 64 bit. I found this issue on Github:
https://github.com/angular/angular/issues/5599
This seems to be the exact same problem, but was marked as fixed in alpha48 last December, so I'm not exactly sure what could be happening here. I have verified with other teams that this issue is not present on OSX.
Is there something I am missing?
Issue https://github.com/angular/angular/issues/7395 goes into greater detail on what the root cause is - the build process for the bundled archive sometimes includes things that Windows tar handlers don't know how to handle, and the devs at Google don't notice because they're working in Unix. It was supposedly fixed permanently in that issue, but that was before the Dart version branched off to be independent and maybe they didn't copy that bit of setup.
I suggest reporting a new issue at https://github.com/dart-lang/angular2/issues and linking to the old 7395.

Xcode 7 crash every time I try to print something in the debugger console

I've searched around and can't find anything on this.
Using Swift 2 and Xcode Version 7.0.1 (7A1001). Every time I execute something in the debugger console, Xcode crashes.
The project is not very big, and has less than 10 third party frameworks.
I can't think of much more information that's relevant, but I'm sure there's more, so please do ask me if there's anything I should add to my question that would help.
I've of course cleaned build and derived data.
It's driving me insane. Thanks!
UPDATE 16/11/12
Submitted rdar://23559366.
How are you maintaining your third party frameworks? Via Carthage?
If so then this is probably your issue: https://github.com/Carthage/Carthage/issues/924
This is an issue if the location of the /Carthage/Build/iOS folder is in a different location to where it was produced (i.e if it was compiled on a different machine and the absolute file path has changed).
A temporary fix would be to run carthage build --no-use-binaries on your machine to rebuild the symbols using the current absolute file path working around the bug.
But if you wasn't using carthage then its probably not your issue so sorry
I had similar problem with Xcode whenever I hit breakpoint.
In case you see this screen right before your Xcode crashes - you are lucky and my fix might save you. All you need to do is open this window and in the Project Navigator, select any file that you want, so that instead of that white blank view you would get your code. After this you are most likely will be able to successfully stop your app at your breakpoint and perform the debug.
I am not sure why this happens, but I suspect that the reason is Debug View Hierarchy mode, which you might have triggered prior to setting you breakpoint and trying to stop at it. At least this is when it happens to me.
I have similar problem earlier.
If you try to print non-optional variable and unfortunately it holds nil value then it breaks/crash. so that make sure declare all possible variables as "Optional type".

Resources