Repository: flutter
Issue: Script sources are missing when running on flutter-tester
Labels: engine,platform-windows,P2,team-engine,triaged-engine

### Steps to reproduce

In VS Code during debugging, we sometimes have to download script sources from the VM because we can't map them to files on the local disk. We use this by calling the VM Service's `getObject()` method.

In the current `beta`/`master` versions of Flutter, the script sources are missing when the app is running on the `flutter-tester` device, which affects integration tests that verify the debugging behaviour.




### Expected results

The script returned from `getObject()` should contain the full source for that script regardless of which device the app is running on.

### Actual results

The script is missing when running on `flutter-tester`.

### Code sample

It's difficult to provide a code sample to run here because it requires running an app and sending requests to the VM Service. I could try to make a script that runs a Flutter app and does this, but since this kind of issue has happened before (see https://github.com/flutter/flutter/issues/111189) I suspect those familiar with how these sources are provided will probably understand what's wrong (FYI @jason-simmons since you fixed https://github.com/flutter/flutter/issues/111189).

### Screenshots or Video

Note: I replaced some numerics with zeros in the logs to make comparing them easier while I was debugging this issue.

![image](https://github.com/flutter/flutter/assets/1078012/089e9d8d-37b9-48c5-8bfa-c1d6ee6d473a)

### Logs

Note: I replaced some numerics with zeros in the logs to make comparing them easier while I was debugging this issue.

<details open><summary>Windows VM Service traffic</summary>

```js
==> [VM] {"jsonrpc":"2.0","id":"43","method":"getObject","params":{"isolateId":"isolates/0000","objectId":"libraries/@0000/scripts/dart%3Acore%2Fprint.dart/0"}}
<== [VM] {
	"jsonrpc": "2.0",
	"result": {
		"type": "Script",
		"class": {
			"type": "@Class",
			"fixedId": true,
			"id": "classes/12",
			"name": "Script",
			"library": {
				"type": "@Instance",
				"_vmType": "null",
				"class": {
					"type": "@Class",
					"fixedId": true,
					"id": "classes/170",
					"name": "Null",
					"location": {
						"type": "SourceLocation",
						"script": {
							"type": "@Script",
							"fixedId": true,
							"id": "libraries/@0000/scripts/dart%3Acore%2Fnull.dart/0",
							"uri": "dart:core/null.dart",
							"_kind": "kernel"
						},
						"tokenPos": 925,
						"endTokenPos": 0000,
						"line": 23,
						"column": 1
					},
					"library": {
						"type": "@Library",
						"fixedId": true,
						"id": "libraries/@0000",
						"name": "dart.core",
						"uri": "dart:core"
					}
				},
				"kind": "Null",
				"fixedId": true,
				"id": "objects/null",
				"valueAsString": "null"
			}
		},
		"size": 80,
		"fixedId": true,
		"id": "libraries/@0000/scripts/dart%3Acore%2Fprint.dart/0",
		"uri": "dart:core/print.dart",
		"_kind": "kernel",
		"_loadTime": 0,
		"library": {
			"type": "@Library",
			"fixedId": true,
			"id": "libraries/@0000",
			"name": "dart.core",
			"uri": "dart:core"
		},
		"lineOffset": 0,
		"columnOffset": 0,
		"source": "// Copyright (c) 0000, the Dart project authors.  Please see the AUTHORS file\n// for details. All rights reserved. Use of this source code is governed by a\n// BSD-style license that can be found in the LICENSE file.\n\npart of dart.core;\n\n/// Prints an object to the console.\n///\n/// On the web, `object` is converted to a string and that string is output to\n/// the web console using `console.log`.\n///\n/// On native (non-Web) platforms, `object` is converted to a string and that\n/// string is terminated by a line feed (`'\\n'`, U+000A) and written to\n/// `stdout`. On Windows, the terminating line feed, and any line feeds in the\n/// string representation of `object`, are output using the Windows line\n/// terminator sequence of (`'\\r\\n'`, U+000D + U+000A).\n///\n/// Calls to `print` can be intercepted by [Zone.print].\nvoid print(Object? object) {\n  String line = \"$object\";\n  var toZone = printToZone;\n  if (toZone == null) {\n    printToConsole(line);\n  } else {\n    toZone(line);\n  }\n}\n",
		"tokenPosTable":[[19,821,1,826,6,831,11,840,20,848,28],[20,859,10,864,15,868,19,875,26],[21,883,7,890,14,892,16],[22,907,3,911,7,918,14,927,23],[23,933,5,948,20],[24,957,3,964,10],[25,970,5,976,11,977,12],[26,986,3],[27,988,1]]},
	"id": "43"
}
```

</details>


<details open><summary>flutter-tester VM Service traffic</summary>

```js
# flutter-tester
==> [VM] {"jsonrpc":"2.0","id":"43","method":"getObject","params":{"isolateId":"isolates/0000","objectId":"libraries/@0000/scripts/dart%3Acore%2Fprint.dart/0"}}
<== [VM] {
	"jsonrpc": "2.0",
	"result": {
		"type": "Script",
		"class": {
			"type": "@Class",
			"fixedId": true,
			"id": "classes/12",
			"name": "Script",
			"library": {
				"type": "@Instance",
				"_vmType": "null",
				"class": {
					"type": "@Class",
					"fixedId": true,
					"id": "classes/170",
					"name": "Null",
					"location": {
						"type": "SourceLocation",
						"script": {
							"type": "@Script",
							"fixedId": true,
							"id": "libraries/@0000/scripts/dart%3Acore%2Fnull.dart/0",
							"uri": "dart:core/null.dart",
							"_kind": "kernel"
						},
						"tokenPos": 925,
						"endTokenPos": 0000,
						"line": 23,
						"column": 1
					},
					"library": {
						"type": "@Library",
						"fixedId": true,
						"id": "libraries/@0000",
						"name": "dart.core",
						"uri": "dart:core"
					}
				},
				"kind": "Null",
				"fixedId": true,
				"id": "objects/null",
				"valueAsString": "null"
			}
		},
		"size": 80,
		"fixedId": true,
		"id": "libraries/@0000/scripts/dart%3Acore%2Fprint.dart/0",
		"uri": "dart:core/print.dart",
		"_kind": "kernel",
		"_loadTime": 0,
		"library": {
			"type": "@Library",
			"fixedId": true,
			"id": "libraries/@0000",
			"name": "dart.core",
			"uri": "dart:core"
		},
		"lineOffset": 0,
		"columnOffset": 0,
		"tokenPosTable":[[19,821,1,826,6,831,11,840,20,848,28],[20,859,10,864,15,868,19,875,26],[21,883,7,890,14,892,16],[22,907,3,911,7,918,14,927,23],[23,933,5,948,20],[24,957,3,964,10],[25,970,5,976,11,977,12],[26,986,3],[27,988,1]]},
	"id": "43"
}
```

</details>


### Flutter Doctor output

<details open><summary>Doctor output</summary>

```console
PS C:\Dev\Google\Flutter\Flutter main> flutter doctor -v
[!] Flutter (Channel master, 3.23.0-14.0.pre.93, on Microsoft Windows [Version 10.0.22631.3737], locale en-GB)
    • Flutter version 3.23.0-14.0.pre.93 on channel master at C:\Dev\Google\Flutter\Flutter main
    ! Warning: `dart` on your path resolves to C:\Dev\Tools\Dart\Stable\bin\dart.exe, which is not inside your current Flutter SDK checkout at
      C:\Dev\Google\Flutter\Flutter main. Consider adding C:\Dev\Google\Flutter\Flutter main\bin to the front of your path.
    • Upstream repository git@github.com:DanTup/flutter.git
    • FLUTTER_GIT_URL = git@github.com:DanTup/flutter.git
    • Framework revision 21d996929b (5 hours ago), 2024-07-02 11:19:31 +0200
    • Engine revision 40c087b315
    • Dart version 3.5.0 (build 3.5.0-321.0.dev)
    • DevTools version 2.37.0
    • If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update checks and
      upgrades.

[✓] Windows Version (Installed version of Windows is version 10 or higher)

[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    • Android SDK at C:\Users\danny\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)
    • All Android licenses accepted.

[✓] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.7.4)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Visual Studio Community 2022 version 17.7.34031.279
    • Windows 10 SDK version 10.0.22621.0

[✓] Android Studio (version 2023.2)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 17.0.9+0--11185874)

[✓] VS Code (version 1.90.2)
    • VS Code at C:\Users\danny\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.93.20240702

[✓] VS Code (version 1.91.0-insider)
    • VS Code at C:\Users\danny\AppData\Local\Programs\Microsoft VS Code Insiders
    • Flutter extension version 3.91.20240529

[✓] Connected device (3 available)
    • Windows (desktop) • windows • windows-x64    • Microsoft Windows [Version 10.0.22631.3737]
    • Chrome (web)      • chrome  • web-javascript • Google Chrome 126.0.6478.127
    • Edge (web)        • edge    • web-javascript • Microsoft Edge 126.0.2592.61

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 1 category.
```

</details>