You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Made LIKE without any wildcard, this crash occurs.
Repro steps
Please , See snippet
Version
11.5.0
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Xamarin
Client OS and version
IOS 17 - Emulator
Code snippets
lke = "b";
foreach (Verb v in verbInstance.Where(v => QueryMethods.Like(v.SearchText, lke.ToString(), false)))
{
ret.Add(new string[] { idiom, v.Text.ToString() });
}
Stacktrace of the exception/crash you're getting
2023-10-24 09:21:07.852982-0400 LexSemanticClient.iOS[21161:362096] System.NotSupportedException: The method 'Boolean Like(System.String, System.String, Boolean)' has to be invoked with a single string constant argument or closure variable
at Realms.RealmResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression node) [0x009c4] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Linq\RealmResultsVisitor.cs:445
at System.Linq.Expressions.MethodCallExpression.Accept (System.Linq.Expressions.ExpressionVisitor visitor) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:109
at System.Linq.Expressions.ExpressionVisitor.Visit (System.Linq.Expressions.Expression node) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionVisitor.cs:34
at Realms.Realm
ResultsVisitor.VisitMethodCall (System.Linq.Expressions.MethodCallExpression node) [0x00081] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Linq\RealmResultsVisitor.cs:205
at System.Linq.Expressions.MethodCallExpression.Accept (System.Linq.Expressions.ExpressionVisitor visitor) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/MethodCallExpression.cs:109
at System.Linq.Expressions.ExpressionVisitor.Visit (System.Linq.Expressions.Expression node) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/ExpressionVisitor.cs:34
at Realms.RealmResults`1[T].GetOrCreateHandle () [0x0001f] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\Linq\RealmResults.cs:75
at System.Lazy`1[T].ViaFactory (System.Threading.LazyThreadSafetyMode mode) [0x00043] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:333 at System.Lazy`1[T].ExecutionAndPublication (System.LazyHelper executionAndPublication, System.Boolean useDefaultConstructor) [0x00022] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:351
at System.Lazy`1[T].CreateValue () [0x00074] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:431
at System.Lazy`1[T].get_Value () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/Current/src/Xamarin.iOS/external/corefx/src/Common/src/CoreLib/System/Lazy.cs:509
at Realms.RealmCollectionBase`1[T].get_IsValid () [0x00000] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\DatabaseTypes\RealmCollectionBase.cs:111
at Realms.RealmCollectionBase`1+Enumerator[T]..ctor (Realms.RealmCollectionBase`1[T] parent) [0x0000d] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\DatabaseTypes\RealmCollectionBase.cs:543 at Realms.RealmCollectionBase`1[T].GetEnumerator () [0x00000] in D:\a\realm-dotnet\realm-dotnet\Realm\Realm\DatabaseTypes\RealmCollectionBase.cs:410 at LexSemanticDicPersistence.Services.LexSemanticDicService.SearchLenghOrMask (System.String dbname, System.String lke) [0x000cc] in Service.cs:262
Relevant log output
No response
The text was updated successfully, but these errors were encountered:
I'm not an Expert on in Realm, but I think the Problem is the Ike.ToString() call. I guess you have to use constant values in realm queries as I experienced the same behavior for normal Queries without the Like Operator.
For Example
verbInstance.Where(v => QueryMethods.Like(v.SearchText, "hello", false))
would work because hello is constant string. I think what you could do in your case would be something like:
var searchParam = Ike.ToString();
verbInstance.Where(v => QueryMethods.Like(v.SearchText,searchParam , false));
Hope that helps :) Otherwise the realm team needs to take care of the issue :)
What happened?
Made LIKE without any wildcard, this crash occurs.
Repro steps
Please , See snippet
Version
11.5.0
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Xamarin
Client OS and version
IOS 17 - Emulator
Code snippets
lke = "b";
foreach (Verb v in verbInstance.Where(v => QueryMethods.Like(v.SearchText, lke.ToString(), false)))
{
ret.Add(new string[] { idiom, v.Text.ToString() });
}
Stacktrace of the exception/crash you're getting
Relevant log output
No response
The text was updated successfully, but these errors were encountered: