bitsdojo_window icon indicating copy to clipboard operation
bitsdojo_window copied to clipboard

Likely incompatibility with NSSM and WinSW

Open boganiLuca opened this issue 2 years ago • 0 comments

This is more a warning for other people than a request for solving the issue, since these errors provided almost zero results on the web.

I've been struggling to start a Flutter Windows app as a service using NSSM or WinSW, but, in both cases, the service-part was carried out perfectly by those app, but the Flutter app instead outputted this lines:

[ERROR:flutter/shell/platform/windows/direct_manipulation.cc(201)] manager_->Activate(window_->GetWindowHandle()) failed
ERR: SwapChain11.cpp:636 (reset): Could not create additional swap chains or offscreen surfaces, HRESULT: 0x887A0022
ERR: SwapChain11.cpp:636 (reset): Could not create additional swap chains or offscreen surfaces, HRESULT: 0x887A0022
ERR: SwapChain11.cpp:643 (reset): Device lost in SwapChain11::reset HRESULT: 0x887A0022, reason: HRESULT: 0x00000000
ERR: SwapChain11.cpp:643 (reset): Device lost in SwapChain11::reset HRESULT: 0x887A0022, reason: HRESULT: 0x00000000
[ERROR:flutter/shell/platform/windows/angle_surface_manager.cc(15)] EGL: Surface creation failed.
[ERROR:flutter/shell/platform/windows/angle_surface_manager.cc(16)] EGL: eglGetError returned 12302
[ERROR:flutter/shell/platform/embedder/embedder_surface_gl.cc(121)] Could not create a resource context for async texture uploads. Expect degraded performance. Set a valid make_resource_current callback on FlutterOpenGLRendererConfig.
[ERROR:flutter/shell/gpu/gpu_surface_gl_skia.cc(43)] Could not make the context current to set up the Gr context.
[ERROR:flutter/shell/gpu/gpu_surface_gl_skia.cc(81)] Could not make the context current to set up the Gr context.
[ERROR:flutter/shell/common/platform_view.cc(75)] Failed to create platform view rendering surface

With some research, I discovered this happened somewhere in between the runApp main Flutter command and the subsequent doWhenWindowReady of this package. No matter what I tried, the Flutter app ran just fine, with all the initializations getting done before the runApp, but it got stuck after that. I started then removing stuff from my Flutter app, and the first thing was this package, of course: I commented out the doWhenWindowReady part, made it so that the app showed a GUI of 1x1 pixel with transparent color (in order to simulate a GUI-less service), and, voilà, the invisible app was started just fine (my logger and print commands confirmed this), although the above errors were still there.

So, be aware that until something changes, this package is not likely to work with NSSM or WinSW (and probably, with other software like them)

boganiLuca avatar Jun 23 '23 14:06 boganiLuca