Skip to content
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

Sharing violation on path exception #116

Open
vynxc opened this issue Dec 6, 2022 · 1 comment
Open

Sharing violation on path exception #116

vynxc opened this issue Dec 6, 2022 · 1 comment

Comments

@vynxc
Copy link

vynxc commented Dec 6, 2022

While Making 2 of the same request to the same url i the System.IO.IOException: 'Sharing violation on path /data/user/0/com.companyname.chaycesanime/cache/com.companyname.chaycesanime/MonkeyCache/Barrel.db' exception.

public static async Task<T> GetAsync<T>(string url, int days = 1, bool forceRefresh = false)
        {
            var json = string.Empty;

            if (Connectivity.NetworkAccess != NetworkAccess.Internet)
                json = Barrel.Current.Get<string>(url);

            if (!forceRefresh && !Barrel.Current.IsExpired(url))
                json = Barrel.Current.Get<string>(url);

            try
            {
                if (string.IsNullOrWhiteSpace(json))
                {
                    json = await client.GetStringAsync(url);
                    Barrel.Current.Add(url, json, TimeSpan.FromDays(days));
                }
                return JsonConvert.DeserializeObject<T>(json);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Unable to get information from server {ex}");
                //probably re-throw here :)
            }

            return default(T);
        }
@vynxc
Copy link
Author

vynxc commented Dec 6, 2022

sadly i cannot use this plugin without thread support. hope it gets fixed soon. ive tried with file store and light db.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant