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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query with Where() returns no results, fails only with UWP release build #1235

Open
mbae23 opened this issue Jun 26, 2024 · 0 comments
Open

Comments

@mbae23
Copy link

mbae23 commented Jun 26, 2024

With an UWP release build (with UseDotNetNativeToolchain = true), this code snippet returns null although there is a row with the given ID in the database.
It works with an UWP debug build or on Android or iOS. (This runs inside a Xamarin app.)

       public ILeistung GetLeistung(LeistungId? id)
       {
           if (id == null)
           {
               return null;
           }

           var dbobj = _dbConn.Table<DbLeistung>().FirstOrDefault(l => l.Id == id.Value.Value);

           return dbobj == null ? null : CreateBOImplLeistung(dbobj);
       }

_dbConn is a SQLiteConnection, and LeistungId is just a wrapper for an int property called "Value".

After this change, it works:

       public ILeistung GetLeistung(LeistungId? id)
       {
           if (id == null)
           {
               return null;
           }

           var searchId = id.Value.Value;

           var dbobj = _dbConn.Table<DbLeistung>().FirstOrDefault(l => l.Id == searchId);

           return dbobj == null ? null : CreateBOImplLeistung(dbobj);
       }

Problem is, I'd have to change 20 methods or so with similar code.
What is going on here? Maybe some optimization that goes wrong?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant