realm-dotnet: System.Environment.GetFolderPath(SpecialFolder)' cannot be used on the current platform.

Exception:In windows 10 xamarin forms project any help please? (PCL project tagrgetting ios android and windows 10 ) this is working just on ios and android

An exception of type ‘System.InvalidOperationException’ occurred in mscorlib.ni.dll but was not handled in user code

Additional information: The API ‘System.Environment.GetFolderPath(SpecialFolder)’ cannot be used on the current platform.

public class Config { private Realm _dblocal; private static Config _config = new Config();

public static Config Instance { get { if (_config == null) _config = new Config(); return _config; } } private Config() { } public RealmConfiguration get_realm_config() {

        var config = new RealmConfiguration("ymora.realm");
        var realm = Realm.GetInstance(config);
        var pathToDatabase = config.DatabasePath;
        return config;
	}

	/// <summary>
	/// Gets the Realm db local.
	/// </summary>
	/// <returns>The db local.</returns>
	public Realm get_db_local()
	{

        if (_dblocal != null)
		{
			return _dblocal;
		}
		else
		{
			_dblocal = Realm.GetInstance(this.get_realm_config());
			return this._dblocal;
		}

	}

}

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

You can see this SO answer for a detailed explanation - the screenshots are fairly old, but the menu items are pretty much the same.

Hey @Amor-Fairouz, could you try this nuget to see if it fixes the issue for you? Realm.Database.2.0.0.nupkg.zip