Description
Problem
Writing to disk on restricted platforms - i.e. Nintento Switch - causes the game to crash: getsentry/sentry-unity#1804
What's happening
We're fetching the installationId
lazily
sentry-dotnet/src/Sentry/SentryOptions.cs
Line 1184 in 9ad2caa
and during event enrichment that installationId
gets resolved
and this causes the InstallationIdHelper to attempt to create a persistent installationId
on disk
sentry-dotnet/src/Sentry/Internal/InstallationIdHelper.cs
Lines 30 to 33 in 9ad2caa
sentry-dotnet/src/Sentry/Internal/InstallationIdHelper.cs
Lines 48 to 56 in 9ad2caa
Solutions
Change the accessor for(Hacky)InstallationId
frominternal
topublic
. That way the Unity SDK can overwrite the lazy initialization during options construction.
sentry-dotnet/src/Sentry/SentryOptions.cs
Line 45 in 9ad2caa
- Add controls over writing to disk. That could be a new option. Or we reuse
CacheDirectoryPath
. With theCacheDirectoryPath
set tonull
we skip all operations writing to disk. We've already gotFileSystem
in place.
We could replace all instances of the SDK directly callingDirectory.Create
forFile.Write
going throughFileSystem
and make that adhere to the options.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status