This repository has been archived by the owner on May 1, 2024. It is now read-only.
[Bug] Occasional crash in TouchEffect because of wrong time zone #1999
Labels
bug
Something isn't working. Breaky break.
Description
DateTime.Now sometimes throws exceptions on Android because of wrong time zone data. This has been reported in dotnet/android#8090. The bug report has been closed because it cannot be reporoduced and the cause has not been found. The working workaround is to use NowUtc instead of Now as a fall-back. This solved the problem in my code. However, I have recently received other crash reports from AppCenter where the same bug is in CommunityToolkit's TouchEffect.
Would it be please possible to replace occurences of DateTime.Now with DateTime.UtcNow in the TouchEffect constructor (https://github.com/xamarin/XamarinCommunityToolkit/blob/main/src/CommunityToolkit/Xamarin.CommunityToolkit/Effects/Touch/TouchEffect.shared.cs)? They are used there anyway only as a workaround for a linker issue.
Stack Trace
Link to Reproduction Sample
Cannot be reproduced (see below).
Steps to Reproduce
Unable to reproduce. The problem is only in certain time zones and probably only on certain devices there.
Expected Behavior
Random crashes on specific devices in certain time zones on Android.
Actual Behavior
No crashes
Basic Information
Workaround
The only workaround would be to copy all the TouchEffect's code into your solution and replace all calls of DateTime.Now with UtcNow there. More user friendly would be to fix it in the CommunityToolkit iteslf.
The text was updated successfully, but these errors were encountered: