Skip to content

Possible regression: Failed to persist session on the file system #5083

@jamescrosswell

Description

@jamescrosswell

I think this might be back. I've had to disable auto tracking to avoid a crash. I thought a try catch would work, but doesn't:

System.IO.FileNotFoundException thrown
  at Interop.ThrowExceptionForIoErrno(Interop.ErrorInfo errorInfo, string path, bool isDirError) in System.Private.CoreLib.dll
  at Interop.CheckIo(Interop.Error error, string path, bool isDirError) in System.Private.CoreLib.dll
  at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(string path, Interop.Sys.OpenFlags flags, int mode, bool failForSymlink, out bool wasSymlink, Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception> createOpenException) in System.Private.CoreLib.dll
  at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, UnixFileMode openPermissions, out long fileLength, out UnixFileMode filePermissions, bool failForSymlink, out bool wasSymlink, Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception> createOpenException) in System.Private.CoreLib.dll
  at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(string fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, UnixFileMode? unixCreateMode, Func<Interop.ErrorInfo, Interop.Sys.OpenFlags, string, Exception> createOpenException) in System.Private.CoreLib.dll
  at System.IO.Strategies.OSFileStreamStrategy..ctor(string path, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, UnixFileMode? unixCreateMode) in System.Private.CoreLib.dll
  at System.IO.Strategies.UnixFileStreamStrategy..ctor(string path, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, UnixFileMode? unixCreateMode) in System.Private.CoreLib.dll
  at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(string path, FileMode mode, FileAccess access, FileShare share, FileOptions options, long preallocationSize, UnixFileMode? unixCreateMode) in System.Private.CoreLib.dll
  at System.IO.Strategies.FileStreamHelpers.ChooseStrategy(FileStream fileStream, string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize, UnixFileMode? unixCreateMode) in System.Private.CoreLib.dll
  at System.IO.FileStream..ctor(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options, long preallocationSize) in System.Private.CoreLib.dll
  at System.IO.FileStream..ctor(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, FileOptions options) in System.Private.CoreLib.dll
  at System.IO.FileStream..ctor(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync) in System.Private.CoreLib.dll
  at System.IO.FileStream..ctor(string path, FileMode mode, FileAccess access, FileShare share) in System.Private.CoreLib.dll
  at System.IO.File.OpenRead(string path) in System.Private.CoreLib.dll
  at Sentry.Internal.FileSystemBase.OpenFileForReading(string path) in Sentry.dll
  at Sentry.Internal.Json.Load<PersistedSessionUpdate>(IFileSystem fileSystem, string filePath, Func<JsonElement, PersistedSessionUpdate> factory) in Sentry.dll
  at Sentry.GlobalSessionManager.<.ctor>b__11_0(string filePath) in Sentry.dll
  at Sentry.GlobalSessionManager.TryRecoverPersistedSession() in Sentry.dll
  at Sentry.Internal.Hub.StartSession() in Sentry.dll
  at Sentry.Integrations.AutoSessionTrackingIntegration.Register(IHub hub, SentryOptions options) in Sentry.dll
  at Sentry.Internal.Hub..ctor(SentryOptions options, ISentryClient client, ISessionManager sessionManager, ISystemClock clock, IInternalScopeManager scopeManager, RandomValuesFactory randomValuesFactory, IReplaySession replaySession, ISampleRandHelper sampleRandHelper, BackpressureMonitor backpressureMonitor) in Sentry.dll
  at Sentry.SentrySdk.InitHub(SentryOptions options) in Sentry.dll
  at Sentry.SentrySdk.Init(SentryOptions options) in Sentry.dll
  at Sentry.Maui.Internal.SentryMauiInitializer.Initialize(IServiceProvider services) in Sentry.Maui.dll
  at Microsoft.Maui.MauiContextExtensions.InitializeAppServices(MauiApp mauiApp) in //src/Core/src/MauiContextExtensions.cs:line 83
  at Microsoft.Maui.Hosting.MauiAppBuilder.Build() in //src/Core/src/Hosting/MauiAppBuilder.cs:line 198
  at CodeLogicMaster.MauiProgram.CreateMauiApp() in D:\AppsInStores\Maui\CodeLogicMaster\CodeLogicMaster\MauiProgram.cs:line 131
  at CodeLogicMaster.Platforms.Android.MainApplication.CreateMauiApp() in D:\AppsInStores\Maui\CodeLogicMaster\CodeLogicMaster\Platforms\Android\MainApplication.cs:line 14
  at Microsoft.Maui.MauiApplication.OnCreate() in /_/src/Core/src/Platform/Android/MauiApplication.cs:line 36
  at Android.App.Application.n_OnCreate(nint jnienv, nint native__this) in Mono.Android.dll

Originally posted by @BillyMartin1964 in #3653

Note

The stack trace clearly indicates a try..catch block isn't catching this exception. Apparently the when is an exception filter, that requires some special treatment in the runtime so there could be bugs around that. However we'd need a repro in order for Microsoft to be able to look into this further. If anyone is able to reliably reproduce this issue on Android, please let us know.

Metadata

Metadata

Labels

.NETPull requests that update .net codeBugSomething isn't working
No fields configured for issues without a type.

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions