Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 Bug Report: querry does not work on Ios but does work on windows and android when using c# #8158

Closed
2 tasks done
StefanLaumann opened this issue May 18, 2024 · 8 comments
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database. question Further information is requested

Comments

@StefanLaumann
Copy link

馃憻 Reproduction steps

When I run this code on a IPhone:

 result = await databases.ListDocuments(AWConst.DatabaseKey, AWConst.ActivityModelTableId,
     [
         Query.Equal("ukey", activity.Ukey)
     ]);

馃憤 Expected behavior

It should give me a result with one document.

馃憥 Actual Behavior

It actually give me an Execption, saying Syntax Error in the querry.
But on Windows and Android it works fine.

馃幉 Appwrite version

Appwrite Cloud

馃捇 Operating system

Something else

馃П Your Environment

I use the .net sdk from nuget in Version 0.8.1

馃憖 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

馃彚 Have you read the Code of Conduct?

@StefanLaumann StefanLaumann added the bug Something isn't working label May 18, 2024
@StefanLaumann
Copy link
Author

This is the querry string, that is created by the querry class:
{"method":"equal","attribute":"ukey","values":["f3e70104-a0dc-4bf9-9c30-dca03a69e53d"]}

It is the same on all plattforms.
I checked again: On a Windows machine, Android did work in a Emulator.
Windows is working.
Ios on a attached IPhone is not working.
Building on a Mac does also not help. Ios is not running, and always giving this exception with the Syntax error in the querry.
But when I try without a querry, the code runs fine even on Ios.
For example, this works fine:
result = await databases.ListDocuments(AWConst.DatabaseKey, AWConst.ActivityModelTableId);

@stnguyen90
Copy link
Contributor

@StefanLaumann, thanks for creating this issue! Would you please share the exact error message you're getting? Would you please also share your project id?

@adityaoberai, any idea why this is happening?

@stnguyen90 stnguyen90 added question Further information is requested product / databases Fixes and upgrades for the Appwrite Database. labels May 19, 2024
@adityaoberai
Copy link
Member

@StefanLaumann, thanks for creating this issue! Would you please share the exact error message you're getting? Would you please also share your project id?

@adityaoberai, any idea why this is happening?

@StefanLaumann when you say that you're running the code on Windows, Android, and iOS, what exactly are you doing? Are you using a framework like .NET MAUI or something else?

Also, can you share the entire error message as well as info about your IDE (for both Windows and Mac)? This will help provide us with more context that can help us debug this issue.

@StefanLaumann
Copy link
Author

Here is a message string:

Invalid query: Syntax error
Appwrite
   at Appwrite.Client.<Call>d__31`1[[Appwrite.Models.DocumentList, Appwrite, Version=0.8.1.0, Culture=neutral, PublicKeyToken=null]].MoveNext()
   at Evento.Data.AppWriteDatabase.CreateActivity(ActivityModel activity) in C:\Users\Stefan\Documents\Projekte\Condivido\Evento\Evento\Data\AppWriteDatabase.cs:line 48
-2146233088
System.Collections.ListDictionaryInternal

That comes from this code:

            List<string> querries = new List<string>();
            querries.Add(Query.Equal("ukey", activity.Ukey));

            DocumentList? result;
            try
            {
                result = await databases.ListDocuments(AWConst.DatabaseKey, AWConst.ActivityModelTableId, querries) ;
            }
            catch (Exception exi)
            {
                var message = exi.Message;
                message += "\n" + exi.Source;
                message += "\n" + exi.StackTrace;
                message += "\n" + exi.HResult;
                message += "\n" + exi.Data;
                Debug.WriteLine(message);
                result = null;
            }

The whole project is a .Net Maui App in .Net 8.
I am using a Desktop Computer with Win 11 and this IDE:
Microsoft Visual Studio Community 2022 (64-Bit) - Current
Version 17.9.6
From here, I can compile the code for Windows, Android and IOS.
Also, I have a Macbook. There I am using VS Code 1.89.1 and the latest MacOS,
but compile only IOS.

The Project ID: 66486edc002f6b4e5592
Listing the documents without a querry works on all plattforms. Also creating a document.
Listing the documents with querry worked on Windows (App compiled for Windows ) and on the Android Simulator, but not on the connected IPhone...

@StefanLaumann
Copy link
Author

I created a new project on AppWrite and a new repository to test this.
Since the repro also contains all the keys, I will delete it in some time again,
but for now, this can be used for testing:

https://github.com/StefanLaumann/MauiAppWriteTest

Kind regards
Stefan

@adityaoberai
Copy link
Member

ccing @abnegate here

@abnegate
Copy link
Contributor

@StefanLaumann This looks like a bug in MAUI, I've opened an issue here: xamarin/xamarin-macios#20629

There is a workaround though, you can add this block to your .csproj file:

	<PropertyGroup Condition="$(TargetFramework.Contains('-ios')) == true OR $(TargetFramework.Contains('-mac')) == true">
		<UseNativeHttpHandler>false</UseNativeHttpHandler>
	</PropertyGroup>

@StefanLaumann
Copy link
Author

@abnegate @adityaoberai @stnguyen90
I have to thank you all for the quick response and the nice workaround.
This did the job :-)
Kind regards
Stefan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working product / databases Fixes and upgrades for the Appwrite Database. question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants