Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows] DPI computation returns 0 for anything older than Windows 10 v1703 #572

Closed
mastermind-computing opened this issue Sep 23, 2019 · 5 comments
Assignees
Labels
bug Something isn't working os-windows

Comments

@mastermind-computing
Copy link

mastermind-computing commented Sep 23, 2019

Hello everyone! I was trying to test my Windows build on some devices.I've transferred windows file in build file to computers and tried to run my app.On some devices the app runs,I mean I can see the window title and borders but inside is just black screen.I couldn't figure out what was happening so I've installed flutter to one of them and this is the output I get when I run the app.I don't know If It's related but flutter asked me to install Windows SDK 8.1 to run the app

Launching lib\main.dart on Windows in debug mode...
Building Windows application...
Syncing files to device Windows...
flutter: ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════

flutter: The following assertion was thrown during performLayout():

flutter: 'package:flutter/src/rendering/view.dart': Failed assertion: line 161 pos 12: '_size.isFinite': is

flutter: not true.

flutter:

flutter: Either the assertion indicates an error in the framework itself, or we should provide substantially

flutter: more information in this error message to help you determine and fix the underlying cause.

flutter: In either case, please report this assertion by filing a bug on GitHub:

flutter:   https://github.com/flutter/flutter/issues/new?template=BUG.md

flutter:

flutter: When the exception was thrown, this was the stack:

flutter: #2      RenderView.performLayout (package:flutter/src/rendering/view.dart:161:12)

flutter: #3      RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1578:7)

flutter: #4      PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:844:18)

flutter: #5      RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:340:19)

flutter: #6      WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:776:13)

flutter: #7      RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:279:5)

flutter: #8      SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1040:15)

flutter: #9      SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:982:9)

flutter: #10     SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:791:7)

flutter: #19     _Timer._runTimers (dart:isolate-patch/timer_impl.dart:382:19)

flutter: #20     _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:416:5)

flutter: #21     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:172:12)

flutter: (elided 10 frames from class _AssertionError, package dart:async, and package dart:async-patch)

flutter:

flutter: The following RenderObject was being processed when the exception was fired: RenderView#4fbdc NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE:

flutter:   debug mode enabled - windows

flutter:   window size: Size(784.0, 561.0) (in physical pixels)

flutter:   device pixel ratio: 0.0 (physical pixels per logical pixel)

flutter:   configuration: Size(Infinity, Infinity) at 0.0x (in logical pixels)

flutter: This RenderObject had the following descendants (showing up to depth 5):

flutter:     child: RenderSemanticsAnnotations#bd593 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

flutter:       child: RenderPointerListener#605f4 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

flutter:         child: RenderAbsorbPointer#2cc6c NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

flutter:           child: RenderSemanticsAnnotations#cf142 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

flutter:             child: _RenderTheatre#bfeb1 NEEDS-LAYOUT NEEDS-PAINT NEEDS-COMPOSITING-BITS-UPDATE

flutter: ════════════════════════════════════════════════════════════════════════════════════════════════════

And this is the doctor output.

C:\Users\ERDEM>flutter doctor -v
[√] Flutter (Channel unknown, v1.10.6-pre.29, on Microsoft Windows [Version 10.0.10240], locale tr-TR)
    • Flutter version 1.10.6-pre.29 at C:\flutter
    • Framework revision 919cc97f6a (3 days ago), 2019-09-20 14:57:05 -0700
    • Engine revision 99092a0436
    • Dart version 2.6.0 (build 2.6.0-dev.1.0 7c1821c4aa)

[X] Android toolchain - develop for Android devices
    X Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, set ANDROID_HOME to that location.
      You may also want to add it to your PATH environment variable.


[√] Visual Studio - develop for Windows (Visual Studio Community 2017 15.9.16)
    • Visual Studio at C:\Program Files (x86)\Microsoft Visual Studio\2017\Community
    • Visual Studio Community 2017 version 15.9.28307.858

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/setup/#android-setup for detailed instructions).

[!] VS Code (version 1.38.1)
    • VS Code at C:\Users\ERDEM\AppData\Local\Programs\Microsoft VS Code
    X Flutter extension not installed; install from
      https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

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

! Doctor found issues in 3 categories.
@stuartmorgan
Copy link
Collaborator

I don't know If It's related but flutter asked me to install Windows SDK 8.1 to run the app

I believe this is just because the runner is currently building with a dynamic runtime rather than a static runtime. It wouldn't be related to a Flutter exception like you're seeing here.

@stuartmorgan
Copy link
Collaborator

device pixel ratio: 0.0 (physical pixels per logical pixel)

This is almost certainly the problem. Sounds like there's a bug in DPI calculation on some machines.

@stuartmorgan
Copy link
Collaborator

Most likely this code is failing on those machines:
https://github.com/flutter/engine/blob/master/shell/platform/windows/win32_dpi_helper.cc
There's currently no logging there, and the error case for querying the DPI is to false, which is going to be converted to 0 since it's an int. We should fix that error case to return a useful value (96), and also add failure logging so we can see why actual calculation isn't working.

@franciscojma86 franciscojma86 self-assigned this Sep 23, 2019
@franciscojma86 franciscojma86 added the bug Something isn't working label Sep 23, 2019
@stuartmorgan
Copy link
Collaborator

stuartmorgan commented Sep 23, 2019

Oh, clarkezone actually left a TODO about this:
https://github.com/flutter/engine/blob/master/shell/platform/windows/win32_window.cc#L10
This API lookup:
https://github.com/flutter/engine/blob/master/shell/platform/windows/win32_dpi_helper.cc#L32
is using a 1703 API, and this:

Microsoft Windows [Version 10.0.10240]

is 1507, so won't have it.

So there's a roadmap for the full solution in the comment. We can start with doing fallback to 96, but we should do the actual fix too.

@mastermind-computing
Copy link
Author

mastermind-computing commented Sep 23, 2019

That was very enlightening. I checked the computers that can run the app and most of them was version 1903 so I will try to upgrade Windows on broken ones and try again.

Edit: It actually worked on all of them after updating Windows.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working os-windows
Projects
None yet
Development

No branches or pull requests

3 participants