Repository: flutter
Issue: [tool_crash] StateError: Bad state: StreamSink is closed
Labels: c: crash,tool,P2,team-tool,triaged-tool

## Command
```sh
flutter --no-color run --machine --track-widget-creation --device-id=emulator-5554 --start-paused --dart-define=flutter.inspector.structuredErrors=true lib\main.dart
```

## Steps to Reproduce
1. ...
2. ...
3. ...

## Logs
StateError: Bad state: StreamSink is closed
```console
#0      _StreamSinkImpl.add (dart:_http/http_impl.dart:912:7)
#1      _WebSocketImpl.add (dart:_http/websocket_impl.dart:1222:11)
#2      VmService._call.<anonymous closure> (package:vm_service/src/vm_service.dart:1785:22)
#3      VmService._call (package:vm_service/src/vm_service.dart:1787:8)
#4      VmService.callServiceExtension (package:vm_service/src/vm_service.dart:1725:14)
#5      VmService.callMethod (package:vm_service/src/vm_service.dart:1716:12)
#6      FlutterVmService.callMethodWrapper (package:flutter_tools/src/vmservice.dart:503:28)
#7      FlutterVmService.getFlutterViews (package:flutter_tools/src/vmservice.dart:934:51)
<asynchronous suspension>
#8      ResidentRunner.connectToServiceProtocol (package:flutter_tools/src/resident_runner.dart:1418:7)
<asynchronous suspension>
#9      HotRunner.attach (package:flutter_tools/src/run_hot.dart:236:7)
<asynchronous suspension>
#10     AppDomain.launch.<anonymous closure> (package:flutter_tools/src/commands/daemon.dart:815:9)
<asynchronous suspension>
#11     AppDomain.launch (package:flutter_tools/src/commands/daemon.dart:813:5)
<asynchronous suspension>
#12     RunCommand.runCommand (package:flutter_tools/src/commands/run.dart:754:15)
<asynchronous suspension>
#13     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1396:27)
<asynchronous suspension>
#14     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#15     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
```
```console
[✓] Flutter (Channel beta, 3.23.0-0.1.pre, on Microsoft Windows [Version 10.0.26241.5000], locale ja-JP)
    • Flutter version 3.23.0-0.1.pre on channel beta at D:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 2feea7a407 (3 weeks ago), 2024-06-06 10:19:10 +0700
    • Engine revision bb10c54666
    • Dart version 3.5.0 (build 3.5.0-180.3.beta)
    • DevTools version 2.36.0

[✓] 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\whes1015\AppData\Local\Android\sdk
    • Platform android-34, build-tools 34.0.0
    • Java binary at: C:\Program Files\Zulu\zulu-17\bin\java.exe
    • Java version OpenJDK Runtime Environment Zulu17.44+53-CA (build 17.0.8.1+1-LTS)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✗] Chrome - develop for the web (Cannot find Chrome executable at .\Google\Chrome\Application\chrome.exe)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[!] Visual Studio - develop Windows apps (Visual Studio Build Tools 2022 17.8.6)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools
    • Visual Studio Build Tools 2022 version 17.8.34525.116
    • Windows 10 SDK version 10.0.22621.0
    ✗ Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/windows#android-setup for detailed instructions).

[✓] IntelliJ IDEA Community Edition (version 2024.1)
    • IntelliJ at C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2024.1.4
    • Flutter plugin version 80.0.2
    • Dart plugin version 241.17890.8

[✓] VS Code (version 1.90.2)
    • VS Code at C:\Users\whes1015\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.26241.5000]
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 127.0.2651.8

[✓] Network resources
    • All expected network resources are available.

! Doctor found issues in 4 categories.

```

## Flutter Application Metadata
**Type**: app
**Version**: 1.2.5
**Material**: true
**Android X**: false
**Module**: false
**Plugin**: false
**Android package**: null
**iOS bundle identifier**: null
**Creation channel**: stable
**Creation framework version**: f468f3366c26a5092eb964a230ce7892fda8f2f8
### Plugins
app_settings-5.1.1
audioplayers-5.2.1
audioplayers_android-4.0.3
audioplayers_darwin-5.0.2
audioplayers_linux-3.1.0
audioplayers_web-4.1.0
audioplayers_windows-3.1.0
connectivity_plus-6.0.3
dynamic_color-1.7.0
firebase_core-2.32.0
firebase_core_web-2.17.2
firebase_messaging-14.9.4
firebase_messaging_web-3.8.7
flutter_local_notifications-17.1.2
fluttertoast-8.2.6
in_app_update-4.2.3
package_info_plus-8.0.0
path_provider-2.1.3
path_provider_android-2.2.6
path_provider_foundation-2.4.0
path_provider_linux-2.2.1
path_provider_windows-2.2.1
shared_preferences-2.2.3
shared_preferences_android-2.2.3
shared_preferences_foundation-2.4.0
shared_preferences_linux-2.3.2
shared_preferences_web-2.3.0
shared_preferences_windows-2.3.2
sqflite-2.3.3+1
url_launcher-6.3.0
url_launcher_android-6.3.3
url_launcher_ios-6.3.0
url_launcher_linux-3.1.1
url_launcher_macos-3.2.0
url_launcher_web-2.3.1
url_launcher_windows-3.1.1