dhindrik / TinyInsights.Maui

TinyInsights is a library for tracking and a website for showing insights for your .NET MAUI app. Data will be saved in Application Insights. The website will help you to show the data in a more mobile app-friendly user interface.
MIT License
32 stars 6 forks source link

First initial Crash is not persisted #9

Closed renelaerke closed 1 month ago

renelaerke commented 1 month ago

Sorry should have seen this on my initial pull - but the initial Crash is not persisted correctly.

The code to File.Create(path) apparently does not release the file fast enough to make WriteAllText succeed.

It thows the exception: "The process cannot access the file '/crashes.mauiinsights' because it is being used by another process."

I removed the check to File.Exists and File.Create as WriteAllText itself will create any missing file.

I also implemented ResetCrashes() method to remove crashes from the file when they have been reported to AppInsights.

dhindrik commented 1 month ago

Thank you for helping me to make the library better.