Sdk: "Could not add/remove hint" error using nndb migration on Windows

Created on 25 Aug 2020  ·  20Comments  ·  Source: dart-lang/sdk

Using Dart SDK at N:\Apps\Dart\nightly-2020-08-25
Dart SDK version: 2.10.0-edge.3e15656b3ef89516a36e0b3d66150e881ba2fa8d (be) (Tue Aug 25 12:15:29 2020 +0000) on "windows_x64"

  • git clone https://github.com/DanTup/dart-repro-migrate
  • cd dart-repro-migrate
  • N:\Apps\Dart\nightly-2020-08-25\bin\pub get
  • N:\Apps\Dart\nightly-2020-08-25\bin\dart migrate --skip-pub-outdated
  • Click lib/my_migrate_project.dart in the project list
  • Click "line 10: Added a non-null assertion to nullable expression" (the single item in the last list)
  • ## Issue 1: Bad path shown:
    > Map​.entries (..\..\..\..\..\N:\Apps\Dart\nightly-2020-08-25\lib\core\map.dart:241): type argument 0 of return type of Map​.entries (map​.dart:241:32)
  • Click the "..\..\..\..\..\N:\Apps\Dart\nightly-2020-08-25\lib\core\map.dart:241" link
  • Click "Add /*!*/ hint" button
  • ## Issue 2: Error notification pops up:
    (Note it's looking in the SDK folder for my_migrate_project.dart)
    > Could not add/remove hint
    > FileSystemException(path=N:\Apps\Dart\nightly-2020-08-25\lib\coremy_migrate_project.dart; message=Cannot open file)

Untitled

@srawlins

P1 area-migration type-bug

Most helpful comment

I've filed #43803, #43804, and #43805 for these other issues.

All 20 comments

@srawlins - can you take a look? I don't know if this version (for the bug report) contains your recent fixes.

I believe it should include b1094db and e7c79ae (it was the nightly built from 3e15656b3ef89516a36e0b3d66150e881ba2fa8d around 8 hours ago).

Today is a busy day, but I plan on making "Migrator on Windows" my priority for the rest of the week.

This is forked from Danny's comments here: https://github.com/dart-lang/sdk/issues/42636, which may have more context.

@DanTup Thanks for the excellent repro steps. I'm having trouble reproducing in unit tests (on a Mac :/) but I'm wondering if the drive letter is related. Your Dart SDK (and so Map.entries) are on N:; what about the cloned package, and your current working directory? Also N:? A different drive?

Your Dart SDK (and so Map.entries) are on N:; what about the cloned package, and your current working directory? Also N:? A different drive?

Ah sorry, I didn't include the path to that. It's on a different drive at M:\Dev\TestStuff\dart_migrate_issue

Oh thank goodness. I can reproduce. 🎉 🥳 🎉

It does have to do with separate drive letters.

(Note: in unit tests, I am finding more odd things; an assertion fails, or the test wants to do several casts and turn () => null into () => null!; I think these are all unrelated, but you still might run into them while migrating.)

Great, thanks! I was able to get things running from source (so don't need to wait for a nightly build) so if you let me know when you think you have a fix, I can do some more testing.

@srawlins btw, slightly off-topic.. would it be reasonable to add a --machine mode that puts command line output into JSON (eg. for the URL to launch, and also an error if the pub check fails)? That way we could add a command to the IDEs that launches this automatically without dropping to a terminal. If the pub check fails, we could show a notification with an option to review the output, or "run anyway" (which just re-runs with the --skip flag).

We could do it by parsing text, but JSON would be much better.

@DanTup I've requested this at https://github.com/dart-lang/sdk/issues/43224

I think I have fixed the bug, but the Windows test bots are giving different results than my local tests, so I'm re-opening to address those tests.

Let me know if/when you want me to do any testing on my PC here!

@srawlins I still see this on the latest nightly:

Dart SDK version: 2.10.0-edge.42c4c3c1bdc9d103ec6cbbc3ddc3047538a3aa37 (be) (Mon Sep 7 12:36:13 2020 +0000) on "windows_x64"

The path looks less bad, but still has a leading slash:

image

But following the instructions above still results in the same error (it's still looking inside the SDK for my files):

image

I'm working on a good Windows situation to tackle this again.

👍

Let me know if you want me to test anything here. I'm not set up to build the SDK, but can use the nightlies and can run the migrate tool from latest source (with previous nights VM build).

I've got a Windows setup now and the steps all work for me:

  • dart.exe --version: Dart SDK version: 2.10.0-edge.e89279c85f80d57889a8a15757699c951200b391 (be) (Tue Sep 22 21:59:31 2020 +0000) on "windows_x64"
  • Sample project is at E:\dart-repro-migrate
  • C:\Users\srawlins\dart-sdk\sdk\out\ReleaseX64\dart-sdk\bin\dart migrate --skip-pub-outdated
  1. Click lib/my_migrate_project.dart in the project list

    All good

  2. Click "line 10: Added a non-null assertion to nullable expression" (the single item in the last list)

    The URL shown in the status bar is: 127.0.0.1:59486/E:/dart-repro-migrate/lib/my_migrate_project.dart?line=10&offset=409&authToken=xyz. It links fine.

  3. Click the "..........N:\Apps\Dart\nightly-2020-08-25\lib\core\map.dart:241" link

    The link now says:

    Map​.entries (/C:/Users/srawlins/dart-sdk/sdk/out/ReleaseX64/dart-sdk/lib/core/map.dart:241): type argument 0 of return type of Map​.entries (map​.dart:241:32)

    (The slash before C: is fine.)

  4. Click "Add /*!*/ hint" button

    The URL shown in the status bar is: 127.0.0.1:59609/E:/dart-repro-migrate/lib/my_migrate_project.dart?offset=355&end=355&replacement=%2F%2A%21%2A%2F. It links fine.

Any work left before we can close this?

We should see if it is still reproducible.

@DanTup can you still reproduce this on your end, with a recent version of Dart/Flutter?

Sorry, I missed some of the previous notifications. I tested this again, and do not see the error anymore. Some minor issues I did see though (lmk if these are better in their own issues - or are expected/known):

  1. Inconsistent path formats

path_formats

  1. Weird text rendering issues

There's some weird ghosting of text - looks like it's being rendered twice in different colours with the positions drifting out of sync.

text_ghosting

  1. Changes made on disk before clicking "Apply Migration"

When I clicked "Add /!/" the file was immediately modified on disk. Based on the dialog that appears when clicking "Apply Migration", I was expecting it to only make changes when I clicked that button. I'm not sure if this is intended?

I've filed #43803, #43804, and #43805 for these other issues.

Was this page helpful?
0 / 5 - 0 ratings