Skip to content
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
This repository was archived by the owner on Feb 25, 2026. It is now read-only.

Setting a value of NaN to StaggeredLayout.DesiredColumnWidth will cause the app to become unresponsive #4063

Closed

Description

@winston-de

Describe the bug

Setting a value of NaN for StaggeredLayout.DesiredColumnWidth will cause the app to become unresponsive. Sometimes it will even give the good ol' " has stopped responding" dialog.

  • Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work:

Steps to Reproduce

  • Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)

Steps to reproduce the behavior:

  1. Go to staggered layout control
  2. Go to xaml tab
  3. Find the staggered layout definition, and set DesiredColumnWidth to NaN
  4. App will become unresponsive, and will eventually crash
<controls:StaggeredLayout DesiredColumnWidth="NaN"
                          ColumnSpacing="5"
                          RowSpacing="5"/>

Expected behavior

If using NaN is not possible, there should be an exception or notification that says this. Also, I don't see anything in the docs about NaN being an invalid parameter.

Screenshots

2021-06-04-113729_Trim.mp4

Environment

NuGet Package(s):

Package Version(s):

Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [x] Insider Build (build number: 19043.1023)

App min and target version:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)

Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT

Visual Studio
- [ ] 2017 (version: )
- [ ] 2019 (version: )
- [ ] 2019 Preview (version: )

Additional context

Add any other context about the problem here.

Activity

  1. added
    bug 🐛An unexpected issue that highlights incorrect behavior
    on Jun 4, 2021
  2. Kyaa-dost commented on Jun 4, 2021

    @Kyaa-dost
    Contributor

    @winston-de Thanks for the highlight! I am able to repro this as well. Do you want to work on this and create a PR?

  3. added this to the 7.1 milestone on Jun 4, 2021
  4. winston-de commented on Jun 4, 2021

    @winston-de
    ContributorAuthor
  5. Rosuavio commented on Jun 11, 2021

    @Rosuavio
    Contributor

    This is relevant to the issue discussion as well. #4064 (comment)

  6. Rosuavio commented on Jun 11, 2021

    @Rosuavio
    Contributor

    I tried setting StaggeredLayout.DesiredColumnWidth to NaN on the sample app from the store and it crashed instead of becoming unresponsive. Its an issue either way, the sample app should show the error from sample without crashing or freezing.

  7. michael-hawker commented on Jun 15, 2021

    @michael-hawker
    Member

    @winston-de I think the root of the question is why you're trying to use NaN as a value, I find that pretty unusual. I know it works in the panel scenario, but then I'd argue why are you trying to use the Panel like that as then it's just a vertical layout?

    Can you elaborate a bit on your main objective/scenario behind this issue (vs. from a technical viewpoint)? Thanks.

    @skendrot any thoughts on this in general? Regardless of the reasoning, I'm not sure why it works for the Panel but not the Layout.

  8. winston-de commented on Jun 16, 2021

    @winston-de
    ContributorAuthor

    Can you elaborate a bit on your main objective/scenario behind this issue (vs. from a technical viewpoint)? Thanks.

    @michael-hawker I have no use for this, I just figured the unhandled exception was not the intended behavior, and in my pr implemented what I presumed to be the expected behavior. However, I can imagine that NaN could be passed in instances where the column size is bound to a NumberBox's value property.

  9. ghost closed this as completedin #4064on Jun 29, 2021
  10. ghost added a commit that references this issue on Jun 29, 2021
    0dde090
  11. ghost locked as resolved and limited conversation to collaborators on Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions