From 2b2821fc5505a708317e4614919abc427f36b787 Mon Sep 17 00:00:00 2001 From: Nikola Irinchev Date: Thu, 31 Aug 2023 11:16:48 +0200 Subject: [PATCH] Fix MissingMemberException calls (#3432) --- CHANGELOG.md | 2 +- Realm/Realm/Dynamic/DynamicObjectApi.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 324b9abc7a..73ea260497 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ * None ### Fixed -* None +* Fixed the message of the `MissingMemberException` being thrown when attempting to access a non-existent property with the dynamic API. (PR [#3432](https://github.com/realm/realm-dotnet/pull/3432)) ### Compatibility * Realm Studio: 13.0.0 or later. diff --git a/Realm/Realm/Dynamic/DynamicObjectApi.cs b/Realm/Realm/Dynamic/DynamicObjectApi.cs index c4d7ababd0..c523a2a473 100644 --- a/Realm/Realm/Dynamic/DynamicObjectApi.cs +++ b/Realm/Realm/Dynamic/DynamicObjectApi.cs @@ -238,7 +238,7 @@ private Property GetProperty(string propertyName) { if (!_managedAccessor.ObjectSchema.TryFindProperty(propertyName, out var property)) { - throw new MissingMemberException($"Property {propertyName} does not exist on RealmObject of type {_managedAccessor.ObjectSchema.Name}", propertyName); + throw new MissingMemberException(_managedAccessor.ObjectSchema.Name, propertyName); } return property; @@ -251,7 +251,7 @@ private Property GetProperty(string propertyName, Func typeC if (!_managedAccessor.ObjectSchema.TryFindProperty(propertyName, out var property)) { - throw new MissingMemberException($"Property {propertyName} does not exist on RealmObject of type {_managedAccessor.ObjectSchema.Name}", propertyName); + throw new MissingMemberException(_managedAccessor.ObjectSchema.Name, propertyName); } if (!typeCheck(property.Type))