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

wpf: add width/height checks when resizing the terminal #7983

Merged
3 commits merged into from Oct 27, 2020

Conversation

javierdlg
Copy link
Member

@javierdlg javierdlg commented Oct 20, 2020

We are getting some watson crash reports that the terminal is attempting
to resize to (0, 0). This change makes it so that we prevent such
resizing and if so, throw an exception before we reach native code.

This commit adds resizing checks that prevent resizing the terminal WPF
control to a size of (0, 0)

@WSLUser
Copy link
Contributor

WSLUser commented Oct 21, 2020

Looks like you are using a fork prior to Super Linter getting added. Can you rebase/merge master to your fork?

@DHowett
Copy link
Member

DHowett commented Oct 21, 2020

Because of the conflict, Javier will need to merge master anyway. Be aware though: the linter doesn't lint C# files, and we use stylecop for that.

@zadjii-msft
Copy link
Member

. Be aware though: the linter doesn't lint C# files, and we use stylecop for that.

image

Well, that's sure to conflict, won't it.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does resizing to (0,0) cause the crashes, or does resizing to 0 in either dimension (i.e. (w,0) or (0,h)) also cause a crash?

@zadjii-msft zadjii-msft added Issue-Bug It either shouldn't be doing this or needs an investigation. Severity-Crash Crashes are real bad news. Area-WPFControl Things related to the WPF version of the TermControl labels Oct 21, 2020
@javierdlg
Copy link
Member Author

javierdlg commented Oct 21, 2020

@zadjii-msft I haven't tested (0, #) but when set to (0,0) it crashes VS since an unhandled exception is raised in the native side. We've added guards for this on the VS side but I thought we'd do it here as well.
We got the details via a Watson dump and you can find more information and the dump here

throw new ArgumentException(nameof(renderSize), "Terminal column or row count cannot be 0.");
}

var dpiScale = VisualTreeHelper.GetDpi(this);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't see why we need this line..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it came from a bad merge. Pushing a fix...

Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the one question

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 22, 2020
@microsoft-github-updates microsoft-github-updates bot changed the base branch from master to main October 22, 2020 00:26
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 23, 2020
@DHowett DHowett changed the title Added checks when resizing the terminal wpf: add width/height checks when resizing the terminal Oct 27, 2020
@DHowett DHowett added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 27, 2020
@ghost
Copy link

ghost commented Oct 27, 2020

Hello @DHowett!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 5a518e5 into main Oct 27, 2020
@ghost ghost deleted the dev/jadelaga/PreventInvalidResize branch October 27, 2020 01:57
DHowett pushed a commit that referenced this pull request Oct 28, 2020
We are getting some watson crash reports that the terminal is attempting
to resize to `(0, 0)`. This change makes it so that we prevent such
resizing and if so, throw an exception before we reach native code.

This commit adds resizing checks that prevent resizing the terminal WPF
control to a size of `(0, 0)`

(cherry picked from commit 5a518e5)
@ghost
Copy link

ghost commented Nov 11, 2020

🎉Windows Terminal v1.4.3141.0 has been released which incorporates this pull request.:tada:

Handy links:

@ghost
Copy link

ghost commented Nov 11, 2020

🎉Windows Terminal Preview v1.5.3142.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-WPFControl Things related to the WPF version of the TermControl AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Severity-Crash Crashes are real bad news.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants