Open federgraph opened 5 years ago
I am attaching a MainPage.xaml.cs test file (zipped) for a minimal test project.
1) New empty uwp project 2) reference Microsoft.Toolkit.Uwp.UI.Controls.DataGrid 3) In Mainpage.xaml add x:Name="hg" to Grid 4) update MainPage.xaml.cs from attached file 5) run app 6) Edit cell in R1 column, last row: ok 7) Edit cell R1 column, 1st or 2nd row: crash
1) xaml looks like this
<Grid x:Name="hg"></Grid>
2) Edit any editable cell, does not matter. 2) Problem shows if edited row is NOT last row.
@federgraph, thanks for the detailed bug report.
This issue seems inactive. It will automatically be closed in 14 days if there is no activity.
Thanks federgraph for patiently waiting while the team is still investigating the issue.
@anawishnoff @RBrid can we please have an update on this issue? Thanks
Thanks federgraph for patiently waiting while the team is still investigating the issue.
@anawishnoff @RBrid can we please have an update on this issue? Thanks
Thanks federgraph for patiently waiting while the team is still investigating the issue.
@anawishnoff @RBrid can we please have an update on this issue? Thanks
I retested today with the latest code from main, and I think the issue is still valid.
I can reproduce the problem when I take the naive approach and reassign to ItemsSource. In my real code I found a much better way - which avoids assigning a new ItemSource, but the test case project should not crash when someone does something similar.
The comment above links to the exact location of my "quick fix":
if (firstFullSlot == -1)
{
// Assertion(slot >= 0) would otherwise crash the app when calling GetExactSlotElementHeight below
Debug.WriteLine("bingo");
return true;
}
It will probably be difficult to find the root source of the problem, so why not take the quick fix if there is no risk?
Thanks federgraph for patiently waiting while the team is still investigating the issue.
@anawishnoff @RBrid can we please have an update on this issue? Thanks
Bug report and fix suggestion.
Current behavior
In DataGridRows.cs, in method GetExactSlotElementHeight, the slot parameter can somtimes be -1, then the assert will fail, and the application will crash.
Expected behavior
Don't call the method when slot == -1. The fix that I am running with is inside of method internal bool ScrollSlotIntoView(int slot, bool scrolledHorizontally):
Minimal reproduction of the problem with instructions
The situation when the problem shows:
Environment