xamarin/Xamarin.Forms

[UWP] App crash with System.IO.FileLoadException

Ouverte

#8 421 ouverte le 7 nov. 2019

 (5 commentaires) (0 réaction) (0 personne assignée)C# (1 926 forks)batch import
e/7 :clock7:has-stacktracehelp wantedi/highinactivep/UWPt/bug :bug:up-for-grabs

Métriques du dépôt

Stars
 (5 644 étoiles)
Métriques de merge PR
 (Aucune PR mergée en 30 j)

Description

Description

Sometimes my application crashes with System.IO.FileLoadException when suspending. I suppose that the whole body (not part) of method Xamarin.Forms.Platform.UWP.WindowsSerializer.SerializePropertiesAsync (https://github.com/xamarin/Xamarin.Forms/blob/master/Xamarin.Forms.Platform.UAP/WindowsSerializer.cs) should be surrounded in try/catch block. My application is multi-instance and I think that the method tries to write to the same file regardless of the instance.

Steps to Reproduce

I was not able to reproduce the issue, but below is the report from AppCenter Diagnostics:

<SerializePropertiesAsync>d__2.MoveNext ()
System.IO.FileLoadException: Proces nie może uzyskać dostępu do pliku, ponieważ jest on używany przez inny proces. Plik jest używany. Zamknij go przed kontynuowaniem. 

System.Runtime.ExceptionServices ExceptionDispatchInfo.Throw () + 0x:21
System.Runtime.CompilerServices TaskAwaiter.ThrowForNonSuccess (Task) + 0x:70
System.Runtime.CompilerServices TaskAwaiter.HandleNonSuccessAndDebuggerNotification (Task) + 0x:38
System.Runtime.CompilerServices TaskAwaiter.ValidateEnd (Task) + 0x:17
Xamarin.Forms.Platform.UWP.WindowsSerializer <SerializePropertiesAsync>d__2.MoveNext () + 0x:202
System.Runtime.ExceptionServices ExceptionDispatchInfo.Throw () + 0x:21

Xamarin.Forms.Application <SetPropertiesAsync>d__93.MoveNext () + 0x:159
System.Runtime.ExceptionServices ExceptionDispatchInfo.Throw () + 0x:21

Xamarin.Forms.Application <SavePropertiesAsync>d__66.MoveNext () + 0x:140
System.Runtime.ExceptionServices ExceptionDispatchInfo.Throw () + 0x:21

Xamarin.Forms.Platform.UWP.WindowsBasePage <OnApplicationSuspending>d__9.MoveNext () + 0xff
System.Runtime.ExceptionServices ExceptionDispatchInfo.Throw () + 0x:21

__Interop ComCallHelpers.Call (__ComObject, RuntimeTypeHandle, Int32) + 0xb:8
__Interop ForwardComStubs.Stub_14[TThis] (__ComObject, Int32) + 0x:24
Microsoft.AppCenter.Utils ApplicationLifecycleHelper.<ctor>b__17_1 (Object, UnhandledErrorDetectedEventArgs) + 0x3d

Expected Behavior

The app should not crash.

Actual Behavior

The app sometimes crashes.

Basic Information

  • Version with issue: 4.2.0.910310
  • Platform Target Frameworks:
    • UWP: 10.0.18362

Guide contributeur