Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MacOS] App crash when unable to write Configuration file #582

Closed
SiMet opened this issue Jun 12, 2024 · 2 comments
Closed

[MacOS] App crash when unable to write Configuration file #582

SiMet opened this issue Jun 12, 2024 · 2 comments
Labels
Milestone

Comments

@SiMet
Copy link

SiMet commented Jun 12, 2024

We faced application crash on MacOS when user does not have access to .config directory.
There is an exception System.UnauthorizedAccessException
Access to the path '/Users/silentum/.config/MyCoolApp/MyCoolApp/NetSparkleUpdater' is denied.

To reproduce this issue I removed .config and then created it as root with chmod 0707.

In our code we do StartLoop(true, true, TimeSpan.FromMinutes(30)) on SparkleUpdater object

We susspect that this is because async void OnWorkerDoWork is throwing exception and we are unable to catch it. (change to async Task could solve this issue).
There is also no catch for System.IO exception in JSONConfiguration.GetSavePath when creating directory which could prevent this crash.

Crash call stack:

JSONConfiguration.cs in string JSONConfiguration.GetSavePath() at line 122
JSONConfiguration.cs in new JSONConfiguration(IAssemblyAccessor assemblyAccessor, string savePath) x 2 at line 51
SparkleUpdater.cs in Configuration SparkleUpdater.get_Configuration() at line 258
SparkleUpdater.cs in async void SparkleUpdater.OnWorkerDoWork(object sender, DoWorkEventArgs e) at line 1921
@SiMet
Copy link
Author

SiMet commented Jun 12, 2024

Related: #397

@Deadpikle
Copy link
Collaborator

Deadpikle commented Jun 13, 2024

@SiMet,

Thank you for the report.

#397 is not related.

You may want to consider upgrading to .NET 8, as at that time they updated the folder that Environment.SpecialFolder.ApplicationData points to (see docs here), which should be more reliable.

That being said, I have:

  • If the default folder for JSONConfiguration cannot be found, tries two other locations in hopes that one is usable.
  • If JSONConfiguration fails to be created, creates a DefaultConfiguration object, which basically does nothing special.
  • Noted in UPGRADING.md about what might happen on an upgrade of one's app to .NET 8+.

@Deadpikle Deadpikle added the bug label Jun 13, 2024
@Deadpikle Deadpikle added this to the 3.x milestone Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants