Skip to content

flutter test breakpoint uris from observatory are prefixed with triple-slashes (but no file:) #16352

Closed

Description

@DanTup

I'm writing some tests against the debug adapters in Dart Code and found that the uris that come back from observatory for flutter test aren't as expected - they seem to be prefixed with three slashes but do not have a file: prefix (on Travis at least, the same tests don't seem to fail locally on my MacBook!). In the Dart VM, they come back like file:///home/travis/build/Dart-Code/Dart-Code/test/test_projects/hello_world/bin/main.dart.

Request to set breakpoint:

{
	"id": "638",
	"method": "addBreakpointWithScriptUri",
	"params": {
		"isolateId": "isolates/810530805",
		"scriptUri": "/home/travis/build/Dart-Code/Dart-Code/test/test_projects/flutter_hello_world/test/hello_test.dart",
		"line": 5
	}
}

Response:

{
	"jsonrpc": "2.0",
	"result": {
		"type": "Breakpoint",
		"fixedId": true,
		"id": "breakpoints\/1",
		"breakpointNumber": 1,
		"resolved": false,
		"location": {
			"type": "UnresolvedSourceLocation",
			"script": {
				"type": "@Script",
				"fixedId": true,
				"id": "libraries\/@271299658\/scripts\/%2F%2F%2Fhome%2Ftravis%2Fbuild%2FDart-Code%2FDart-Code%2Ftest%2Ftest_projects%2Fflutter_hello_world%2Ftest%2Fhello_test.dart\/162a63a3e73",
				"uri": "\/\/\/home\/travis\/build\/Dart-Code\/Dart-Code\/test\/test_projects\/flutter_hello_world\/test\/hello_test.dart",
				"_kind": "library"
			},
			"line": 5
		}
	},
	"id": "638"
}

I can't say for sure this is a bug, as I don't think these uri formats are well documented (though I think they should be - slightly related are #15513 and dart-lang/sdk#32500). Having different formats across VM, Flutter Run and Flutter Test makes things complicated for editor integrations though - we currently have to explode paths from the editor into a bunch of different formats to ensure we get the right one for a breakpoint to be hit, and then we have to try and convert them back to ensure we can navigate to code in the editor. If we can agree/document a format and ensure all the tools stick to them, it would simplify things a lot in the editor and reduce the chances of end users getting bugs (like missed breakpoints).

Activity

  1. DanTup commented on Apr 17, 2018

    @DanTup
    ContributorAuthor

    I can no longer repro this - I think maybe it was fixed in a recent beta of Flutter. I'll re-open if I think I can repro/see it again.

  2. DanTup commented on May 7, 2018

    @DanTup
    ContributorAuthor

    Actually, I can repro this locally now. When I'm stopped at an exception in my tests, I'm getting stacks like this:

    {
    	"jsonrpc": "2.0",
    	"result": {
    		"type": "Stack",
    		"frames": [
    			{
    				"type": "Frame",
    				"kind": "Regular",
    				"location": {
    					"type": "SourceLocation",
    					"script": {
    						"type": "@Script",
    						"fixedId": true,
    						"id": "libraries\/@643181911\/scripts\/%2F%2F%2FUsers%2Fdantup%2FDev%2FDart-Code%2Ftest%2Ftest_projects%2Fflutter_hello_world%2Ftest%2Fwidget_test.dart\/16339c6bc51",
    						"uri": "\/\/\/Users\/dantup\/Dev\/Dart-Code\/test\/test_projects\/flutter_hello_world\/test\/widget_test.dart",
    						"_kind": "library"
    					},
    					"tokenPos": 42
    				},

    Note the uri is prefixed with triple-slashes. I think /Users/dantup or file:///Users/dantup would be normal (it should match whatever we get from the VM or Flutter Run).

  3. reopened this on May 7, 2018
  4. added
    a: debugging
    on Jun 26, 2018
  5. bkonyi commented on Jul 30, 2018

    @bkonyi
    Contributor

    Hm, looks like I'm having issues reproducing this myself on my Linux machine. Is there anything special about the project you're using? I'd just like to get my environment as close to yours as possible.

    Also, when you're observing the missing file: in the URI is it happening consistently for all URIs reported by the vm-service?

  6. DanTup commented on Jul 31, 2018

    @DanTup
    ContributorAuthor

    I can't remember if this happened only on specific platforms.. I'll make a branch of Dart Code with a failing test because of this (I have a test, but it's marked skip) and post back..

  7. DanTup commented on Jul 31, 2018

    @DanTup
    ContributorAuthor

    Well, I can't repro locally, and the CIs passed the test against both Dev(Master) and Stable(Beta) on all three platforms when I ran it on a branch:

    screen shot 2018-07-31 at 10 18 13 am

    So, my guess is that it must've been fixed (and rolled into Flutter after 7th May but before the current beta was taken at the end of May).

    I'll close this and unskip this test for real on my builds and if I see any failures, I'll post back.

  8. github-actions commented on Sep 2, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  9. locked as resolved and limited conversation to collaborators on Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

a: debugging

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions