-
Type: Bug
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
How frequently does the bug occur?
Always
Description
Hello,
We are facing an error when running a migration from realm 10.9.0 to realm-kotlin 1.15.0
The RealmObject looks like this:
@RealmClass(embedded = true) open class ExampleEntity() : RealmObject() { var data: RealmDictionary<String> = RealmDictionary() }
And the migration script just tries to set the data to the new object like so:
migrationContext.enumerate("ExampleEntity") { oldObject, newObject -> val data = oldObject.getNullableValueDictionary("data", String::class) println("Data: $data") newObject?.run { set("data", data) } }
When the migration script runs, we can verify that the oldObject data printed out is correct, however in the resulting database, data value appears to be an empty object and we get a type error triggered by the line that attempts to set the data: set("data", data)
Stacktrace & log output
Unable to find source-code formatter for language: shell. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
Trying to access property 'ExampleEntity.data' as type: 'RealmDictionary<class io.realm.kotlin.internal.ManagedRealmDictionary>' but actual schema type is 'RealmDictionary<class kotlin.String>'
Can you reproduce the bug?
Yes, a related demo will be attached shortly
Reproduction Steps
- Build project with Java version of the database
- Run migration to Kotlin version
- Notice the error on Logcat
Version
1.15.0
What Atlas App Services are you using?
Local Database only
Are you using encryption?
Yes
Platform OS and version(s)
Android API 8+
Build environment
Android Studio version: Android Studio Koala | 2024.1.1
Android Build Tools version: 35
Gradle version: 8.7