Uploaded image for project: 'Realm .NET SDK'
  1. Realm .NET SDK
  2. RNET-167

Realm.DeleteRealm(config) intermittenlty fails

      <!--- Questions: If you have questions about how to use Realm, please ask on -->
      <!--- StackOverflow: http://stackoverflow.com/questions/ask?tags=realm -->
      <!--- We monitor the

      realm

      tag. -->

      <!--- Feature Request: Just fill in the first two sections below. -->

      <!--- Bugs: To help you as fast as possible with an issue please describe your issue -->
      <!--- and the steps you have taken to reproduce it in as much detail as possible. -->

      <Unable to render embedded object: File (--- Thanks for helping us help you) not found. -->

      Goals

      Realm.DeleteRealm(config) intermittenlty fails
      Trying to delete current ream database files that the app uses after closing the realm instances.

      <!--- What are you trying to achieve? -->

      Expected Results

      Should delete realm files, Since ``

      IsInTransaction

      `` is false.

      Feature Request

      Since ``

      DeleteRealm

      `

       have return type void , is it possible to have a new method or extend this to return 

      `

      bool

      ``

      Actual Results

      ``

      Exception : Unable to delete Realm because it is still open

      ``

      Steps to Reproduce

      Steps

      • Get current instance from singleton class
      • Store it in class local variable - ``
        realmInstance

        ``

      • Dispose/Close the instance (I made sure I used Dispose on both local config and the one with singleton)
      • Call Realm.DeleteRealm(config)

      Code Sample

      RealmSingleton.cs

      realmInstance = RealmSingleton.Instance.RealmSingletonInstance;
      
      //other stuff
      if (!realmInstance.IsClosed)
      {
              realmInstance.Dispose();
      }
      
      
      if (!RealmSingleton.Instance.RealmSingletonInstance.IsClosed)
      {
              RealmSingleton.Instance.RealmSingletonInstance.Dispose();
      }
      if (realmInstance.IsClosed && RealmSingleton.Instance.RealmSingletonInstance.IsClosed)
      {
              try
              {
                      Realm.DeleteRealm(RealmSingleton.Instance?.RealmSingletonInstance?.Config);
              }
              catch (Exception e3)
              {
      
                      Debug.WriteLine("Unable to delete realm." + e3.StackTrace);
              }
      
      }
      

      Version of Realm and Tooling

      Visual Studio 15.8.7
      Xamarin Forms 3.3.x
      Realm Nuget 3.2.1

      • Realm Object Server Version: ?
      • Flavor:
        • [x] Developer
        • [ ] Professional
        • [ ] Enterprise
      • Server OS & Version: ? (e.g. CentOS 6) - NA - database product
      • Client SDK Version: ? - Realm Nuget 3.2.1
      • Client OS & Version: ? - Running on Android

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: