google / flutter-desktop-embedding

Experimental plugins for Flutter for Desktop
Apache License 2.0
7.1k stars 604 forks source link

Throws MissingPluginException during test #891

Closed rk0cc closed 2 years ago

rk0cc commented 2 years ago

Is this a bug in one of the plugins in this project?

Which plugin is this bug report about?

window_size

Describe the bug

After run the Flutter GUI application, this error was shown when running flutter test:

E:\Source Code\will_pub>flutter test
00:09 +0: loading E:\Source Code\will_pub\test\pubspec\dependency\dependencies_test.dart                                                                            Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell: 
00:09 +0 -1: loading E:\Source Code\will_pub\test\pubspec\dependency\dependencies_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\dependencies_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:09 +0 -2: loading E:\Source Code\will_pub\test\pubspec\dependency\git_dependency_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\git_dependency_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:09 +0 -3: loading E:\Source Code\will_pub\test\pubspec\dependency\hosted_dependency_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\hosted_dependency_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:09 +0 -4: loading E:\Source Code\will_pub\test\pubspec\dependency\local_dependency_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\local_dependency_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:09 +0 -5: loading E:\Source Code\will_pub\test\pubspec\pubspec_validate_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\pubspec_validate_test.dart": Connection closed before test suite loaded.
00:09 +0 -5: Some tests failed.

E:\Source Code\will_pub>flutter test
00:08 +0: loading E:\Source Code\will_pub\test\pubspec\dependency\dependencies_test.dart                                                                            Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:08 +0 -1: loading E:\Source Code\will_pub\test\pubspec\dependency\dependencies_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\dependencies_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:08 +0 -2: loading E:\Source Code\will_pub\test\pubspec\dependency\git_dependency_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\git_dependency_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:08 +0 -3: loading E:\Source Code\will_pub\test\pubspec\dependency\hosted_dependency_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\hosted_dependency_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:08 +0 -4: loading E:\Source Code\will_pub\test\pubspec\dependency\local_dependency_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\dependency\local_dependency_test.dart": Connection closed before test suite loaded.
Shell: [ERROR:flutter/shell/testing/tester_main.cc(400)] Unhandled exception
Shell: Exception: MissingPluginException(No implementation found for method setWindowTitle on channel flutter/windowsize)
Shell: Stack trace: #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)
Shell: <asynchronous suspension>
Shell: #1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:356:43)
Shell: <asynchronous suspension>
Shell: #2      WindowSizeChannel.setWindowTitle (package:window_size/src/window_size_channel.dart:191:5)
Shell: <asynchronous suspension>
Shell:
00:09 +0 -5: loading E:\Source Code\will_pub\test\pubspec\pubspec_validate_test.dart [E]
  Failed to load "E:\Source Code\will_pub\test\pubspec\pubspec_validate_test.dart": Connection closed before test suite loaded.
00:09 +0 -5: Some tests failed.

It keep telling setWindowTitle not found during test but all files of test source code are not related with Flutter.

Flutter doctor

[√] Flutter (Channel stable, 2.5.2, on Microsoft Windows [Version 10.0.22000.194], locale en-HK)
    • Flutter version 2.5.2 at C:\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 3595343e20 (12 days ago), 2021-09-30 12:58:18 -0700
    • Engine revision 6ac856380f
    • Dart version 2.14.3

[√] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
    • Android SDK at D:\Android\SDKC
    • Platform android-31, build-tools 31.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • 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 11.0.10+0-b96-7249189)

[√] VS Code, 64-bit edition (version 1.61.0)
    • VS Code at C:\Program Files\Microsoft VS Code
    • Flutter extension version 3.27.0

[√] Connected device (1 available)
    • Windows (desktop) • windows • windows-x64 • Microsoft Windows [Version 10.0.22000.194]

• No issues found!
ghost commented 2 years ago

Same here, but on Linux.

stuartmorgan commented 2 years ago

You are hitting the issue fixed by https://github.com/flutter/flutter/pull/90288, causing your flutter test to run your application's main.dart instead of the test file. You need to either use Flutter master, or delete generated_main.dart from your .dart_tool directory before running flutter test.

This has nothing to do with this plugin, window_size just happens to be a plugin you are calling early in your application main.