Closed daltzctr closed 2 years ago
@daltzctr please feel free to debug that and submit a PR with fix
Okay, I'm able to consistently reproduce the crash and have an exception. I'm going to pull the project source into my project to debug further.
Perhaps this line https://github.com/AndreiMisiukevich/CardView/blob/master/PanCardView/CardsView.cs#L1607 should be wrapped by UI thread invocation for UWP
I'll give that a test when I'm in the office tomorrow. Thanks again.
I've successfully narrowed down the issue to https://github.com/AndreiMisiukevich/CardView/blob/9865b194534e0a6f8530d8ac8f49037a482b5294/PanCardView/Processors/CarouselProcessor.cs#L207-L212
It seems like these functions are returning NaN
and BatchCommit
was barfing on an input of NaN
for the various UI elements. I fixed this by rewriting CalculateFactoredProperty
like the following
protected virtual double CalculateFactoredProperty(double value, double factor, CardsView cardsView, double defaultFactorValue = 1)
{
var val = Abs(value) * (factor - defaultFactorValue) / cardsView.GetSize() + defaultFactorValue;
if (!double.IsNaN(val)) {
return val;
} else {
return defaultFactorValue;
}
}
I don't have the stacktrace (hopefully I can grab it), but occassionally I'll get an exception regarding "Invalid Bounds" pointing at the CarouselView as the offender when moving the UWP application between different monitors having different DPIs.