praeclarum / praeclarum/sqlite-net

ToListAsync fails if no items are found

Open
#809 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
4.5k
Forks
1.4k
PR merge metrics
No merged PRs in 30d

Description

In the async API ToListAsync() fails when no items are found.
When I'm debugging it stops the debugger with no error.

// relatedId value DOES NOT EXIST IN THE DATABASE...
var query = database.Table<T>().Where(i => i.RelatedId == relatedId); 
var unOrdered = await query.ToListAsync(); // This line crashes.

Tested on Visual Studio Code for Mac in a netstandard lib used by a Xamarin project.
sqlite-net-pcl version 1.5.231 (from Nuget)

Edit: the behavior seems to be erratic. Sometimes has worked just by called .ToArrayAsync() before but but others not.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the provided ToListAsync() query with a relatedId that does not exist, using sqlite-net-pcl 1.5.231 in the described Xamarin/netstandard setup. Compare the behavior with ToArrayAsync(); the issue is done when an empty query returns an empty result without stopping the debugger or crashing.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, sqlite
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.