Parse-SDK-dotNET icon indicating copy to clipboard operation
Parse-SDK-dotNET copied to clipboard

fix: Crash when using ParseQuery `include` with anonymous access

Open Werkezeugs opened this issue 1 year ago • 5 comments

Improved fix for this PR

https://github.com/parse-community/Parse-SDK-dotNET/pull/388

Werkezeugs avatar May 30 '24 18:05 Werkezeugs

Thanks for opening this pull request!

  • ❌ Please link an issue that describes the reason for this pull request, otherwise your pull request will be closed. Make sure to write it as Closes: #123 in the PR description, so I can recognize it.

Could you please add a test for this bug?

mtrezza avatar May 31 '24 03:05 mtrezza

Hi @mtrezza ,

not 100% sure how I can design a valid test for this problem. So here some pseudo code to demonstrate the issue. may u can help to find a way to integrate this test?

//Prepare
ParseObject blog = new ParseObject("Blog");
blog["title"] = "My blog";
ParseObject comment = new ParseObject("Comment");
comment["Blog"] = blog;
await comment.SaveAsync();

//Test
var query = ParseClient.Instance.GetQuery<Comment>().Include("Blog");
var results = await query.FindAsync(CancellationToken.None);
List<Comment> items = results.ToList();

Problem:

The var results will be ok, but when casting to the var items list it throws an exception

Werkezeugs avatar Jun 02 '24 10:06 Werkezeugs

@Werkezeugs I looked at the tests and they are not very extensive, no e2e and a lot of mocking is missing, like obj saving. If you cannot add a test and cannot add the mocks, then we can merge without a test.

mtrezza avatar Jun 11 '24 14:06 mtrezza

I will reformat the title to use the proper commit message syntax.