Welcome to Microsoft Q&A!
Also as to why it works on simulator, simulators can use JIT (just in time) compilation as simulators allow run time code generation (which is what JIT compilation does, it compiles from intermediate language (IL) to machine code), however devices cannot use JIT so they must AOT (ahead of time) compile the code so that there is no IL in the app bundle… i.e. everything is pre-compiled to machine code so no run time code generation.
System.Configuration.ConfigurationManager is not part of the .NET profile used by Xamarin. (although other parts of System.Configuration are. See the .NET API Browser: .NET API browser | Microsoft Learn .
Besides , I see you use
Microsoft.EntityFrameworkCore.SqlServer, stop using it , we should not connect directly to an Sql Server from a mobile app.
Take a look at the official docs on on using EntityFrameworkCore with Xamarin.Forms: Getting Started with EF Core and Xamarin - EF Core | Microsoft Learn , which uses the SqlLite EF Core package for connecting to a local, on device, database .
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.