parse-community / Parse-SDK-dotNET

Parse SDK for .NET, Xamarin, Unity.
http://parseplatform.org
Apache License 2.0
322 stars 260 forks source link

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

Open Werkezeugs opened 2 months ago

Werkezeugs commented 2 months ago

Improved fix for this PR

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

parse-github-assistant[bot] commented 2 months ago

Thanks for opening this pull request!

mtrezza commented 2 months ago

Could you please add a test for this bug?

Werkezeugs commented 2 months ago

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

mtrezza commented 2 months ago

@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.

parse-github-assistant[bot] commented 2 months ago

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