-
Notifications
You must be signed in to change notification settings - Fork 504
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.Net Maui iOS project crashes #3171
Comments
Please do not use 4.0.0 for production applications. What is the error you are getting? Also, why are you running the SDK in a client device? That poses a security risk, ideally the architecture should look like: https://docs.microsoft.com/en-in/azure/architecture/solution-ideas/articles/gaming-using-cosmos-db |
It works fine in Debug. But crashes in Release. So, no error. I'm still trying to troubleshoot. I'll upload my sample code in a few minutes. |
I'm still unsuccessful at getting Microsoft.Azure.Cosmos to work with iOS in Release mode. Works just fine in Debug. This is the error I'm getting. C:\Program Files\dotnet\packs\Microsoft.iOS.Sdk\15.4.300-rc.3.83\targets\Xamarin.Shared.Sdk.targets(747,3): error : ILStrip failed for C:/Users/ttirr/.nuget/packages/microsoft.azure. |
I'm using Microsoft documentation (See links below). I have used it successfully in Xamarin.Forms apps in the past. Just won't work with .Net Maui. The link you gave me seems more complex that what I need. |
@trevortirrell The gist of the other link (while complex) tries to show that for Mobile applications, the ideal architecture is having the SDK running in a Web API/service and the mobile devices contacting this Web API/service. Don't create the mobile application that talks to the Cosmos DB endpoint, because you are baking your account key inside a mobile application that can be decompiled. Once a user decompiles the app, it has your account master key. That is why running the SDKs in a mobile application is not a desirable scenario. |
@ealsur Is there a walkthrough / tutorial that shows how to get that to work? For my current application it is only used for a leader board with scores, I don't care about security for this particular app. And regardless it doesn't answer the question as to why it wont compile. That is still an issue that needs addressed / fixed. |
I am not sure there is a full example. Any Web API example would show how to have the SDK running in a Web App, but the whole flow, I don't know. There is a Web API example here: https://docs.microsoft.com/en-us/azure/cosmos-db/sql/sql-api-dotnet-application Even on a leader board, the user has access to your master key, they can do anything on the account, including taking over your collections, reading all your data, even use your account and create a 1M RU collection there and hit you with a huge bill. It is a very scary scenario that you really don't want to have. I am not a NET Maui expert, so I would not know why it won't compile, what we can say though is that it's not an environment or scenario where it is designed to run. |
Closing due to inactivity. Please share more information in case this is still an issue. |
ealsur is right. It's very risky someone could hijack your entire container. It would be too late to feel sorry when you receive a massive bill from microsoft. Azure web api service is very easy to setup for a simple scenario like yours. public static class LeaderboardEndpoints
Put your CosmosDB code inside CosmosDBHelper.RegisterLeaderboardUser(model); From client device : public class RestfulApi
|
Other than I'm on 3.38.1 (vs 3.27.0), Also note: This has been working in production for 4 years with Xamarin.Forms. I'm just trying to upgrade to MAUI. This is a windows-only dll, but 3 1/2 years ago, I was told...
|
If you don't bundle the Microsoft.Azure.Cosmos.ServiceInterop.dll as part of your app, the SDK will still work. However, please see #3171 (comment) for security issues related to running the SDK within the app. |
Thanks for the quick reply! |
I honestly have no expertise in what an ipa module is. But if the build process generates a package and there is a way to remove/ignore a DLL into getting added to the package, you could ignore / skip this one. |
Any idea where this dependency gets introduced? Maybe I can just fork and rebuild cosmos without bringing this dll in? I'm no expert on .csproj files and building either. But don't you think the cosmos team should address this if people can't even build and run the Maui template app (with cosmosdb added) on iOS? probably not MacOS either. |
This DLL has always been there. |
Yeah, it's always been there, but it worked with Xamarin.forms, so I guess I'm in the wrong place? The MAUI team should address this? Thanks for your help. |
I guess? I mean, it's not a change that happened in this library. |
Describe the bug
My .Net Maui iOS app crashes when navigating to the code that uses the Microsoft.Azure.Cosmos package. It works great with Android. Should I try the Azure.Cosmos 4.0.0-preview3?
To Reproduce
Add Microsoft.Azure.Cosmos package to project. iOS crashes on this line
FeedResponse<MyObject> currentResultSet = await queryResultSetIterator.ReadNextAsync();
I'm only able to build from command line (.Net Maui issue). I'm using the following parameter /p:EnableAssemblyILStripping=false. I've also tried /p:MtouchLink=none for the Linker Behavior. Not sure if there is some other flag I need?
Expected behavior
Retrieve data from Azure Cosmos database
Actual behavior
App crashes
Environment summary
.Net Maui RC2
Visual Studio: 17.2 Preview 6
SDK Version: 3.26.1
OS Version: iOS 15.4.1
The text was updated successfully, but these errors were encountered: