hanssens / localstorage

LocalStorage for .NET - A simple and lightweight tool for persisting data in dotnet (core) apps.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

System.IO.Path.Combine (System.String path1, System.String path2)

jitvarpatil opened this issue · comments

Hi, I am creating a new .Net Core Libary. I am getting the following error

System.ArgumentNullException: Value cannot be null. Parameter name: path1 at System.IO.Path.Combine (System.String path1, System.String path2) [0x00003] in <3a61d48d66dd458fa0b64990b6c8f8cc>:0 at Hanssens.Net.Helpers.FileHelpers.GetLocalStoreFilePath (System.String filename) [0x00005] in <69a98ddcb52642bebc50c798ab58d893>:0 at Hanssens.Net.LocalStorage.Persist () [0x00018] in <69a98ddcb52642bebc50c798ab58d893>:0 at ProTest.Droid.MainActivity+<>c.<OnCreate>b__2_0 (System.Object <p0>, System.EventArgs <p1>) [0x00037] in /Users/Inscripts/Projects/ProTest/Droid/MainActivity.cs:47 at Android.Views.View+IOnClickListenerImplementor.OnClick (Android.Views.View v) [0x00011] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 at Android.Views.View+IOnClickListenerInvoker.n_OnClick_Landroid_view_View_ (System.IntPtr jnienv, System.IntPtr native__this, System.IntPtr native_v) [0x00011] in <ff9f3f3d4e134974a889db1b532c9b6e>:0 at at (wrapper dynamic-method) Android.Runtime.DynamicMethodNameCounter.5(intptr,intptr,intptr)

The error is in FileHelpers caused by

Path.Combine(System.AppContext.BaseDirectory, filename);

System.AppContext.BaseDirectory is returning a null value. Is there any work around for this ?

Thanks for the report @jitvarpatil. Looking at the stacktrace you're running on Android and - I assume - with Xamarin. It appears to be a known and reported issue in xamarin-android, which as of today is still unresolved unfortunately.

There is a related/linked issue in the dotnet/extensions repo which covers some workaround. You might want to check that out as well for a workaround?

But bottom line is that because it's a problem at Xamarin-Android, I'm afraid the LocalStorage can't do much about it.