-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
fix: Route file writing through FileSystem
#3614
Conversation
Co-authored-by: Bruno Garcia <bruno@brunogarcia.com>
Just realize the strategy with returning bool has an issue. since the caller doesn't know if it failed, or if it's an option picked by the user and will log a bunch of error with the sdk debug logger You might not be able to hide that all in the file writer abstraction, leaving the knowledge of the option to the callsites and hence skipping the operation altogether. Or change the interface to return some enum where it can be failure or disabled. Or return null boolean to be simple. and document that null means disable and true/false is the real output |
I'd like to keep the |
d587e19
to
88d63f0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
using var writer = new Utf8JsonWriter(file); | ||
|
||
serializable.WriteTo(writer, logger); | ||
writer.Flush(); | ||
file.Dispose(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this couldn’t have using
anymore? I’m concerned an exception will keep dangling filesa
Fixes #3607, getsentry/sentry-unity#1804
Problem
Writing to disk is restricted on platforms like the Switch, causing crashes. There's currently no way to properly opt-out of this. I.e. the SDK creates and tries to persist an ID to disk out-of-the-box.
Solution
DisableFileWrite
.IFileSystem
in place. Making sure to make it is respecting that flagFile.Create
andDirectory.Create
and replace them withIFileSystem
.TODO
create
,move, and
delete` to prevent regressions