Windows build number: Microsoft Windows [Version 10.0.19033.1]
Windows Terminal version (if applicable): 0.7.3291.0, also built from master (7bcb060)
Set a custom scaling factor in Settings > System > Display > "Advanced scaling settings", for example:
Start the terminal
The terminal should start
The terminal crashes almost immediately after loading a blank screen.
In trying to fix this I've reinstalled and also removed profiles.json to get a fresh one. Afterwards I attempted to debug, and got the following call stack:
TerminalControl.dll!gsl::details::terminate() Line 127 C++
TerminalControl.dll!gsl::details::throw_exception<gsl::narrowing_error>(gsl::narrowing_error && __formal) Line 136 C++
TerminalControl.dll!gsl::narrow<float,double>(double u) Line 126 C++
TerminalControl.dll!ScaleRect(winrt::Windows::Foundation::Rect rect, double scale) Line 31 C++
TerminalControl.dll!winrt::Microsoft::Terminal::TerminalControl::implementation::TSFInputControl::_layoutRequestedHandler(winrt::Windows::UI::Text::Core::CoreTextEditContext sender, const winrt::Windows::UI::Text::Core::CoreTextLayoutRequestedEventArgs & args) Line 164 C++
Based on this I realized my display's scaling factor had been set to a custom value (115% or something). I changed it back to the default 100% and it started fine.
Feedback Hub link: https://aka.ms/AA6q09q
Fascinating! Thanks. This might explain a number of the crash-on-startup issues.
I had a look through the code implicated in the stack trace, and it's a classic floating point comparison failure. ScaleRect takes a double which it tries to cast to a float using gsl::narrow. The exception is emitted from gsl::narrow after a failed comparison between floating point values (float and double). After writing a ScaleRect which only uses the gsl::narrow_cast (which just wraps a static_cast) the crash disappears.
ScaleRect is coming from Utils.h in External Dependencies in WinRTUtils and TerminalControl (when viewed in VS19). Would there be any problem editing Utils.h? Would the new ScaleRect function be better?
No problem editing that file, it鈥檚 definitely one of ours :)
Great, I'll PR the fix
:tada:This issue was addressed in #3784, which has now been successfully released as Windows Terminal Preview v0.7.3382.0.:tada:
Handy links:
Just installed Version: 0.7.3382.0 and can confirm that it's all working now. Thanks for the quick response!
Most helpful comment
No problem editing that file, it鈥檚 definitely one of ours :)