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

Adding More Than One Key to TodoTask AdditionalData causes PageIterator delegate to hang #1994

Closed
gtwilliams03 opened this issue Jun 29, 2023 · 10 comments · Fixed by microsoft/kiota-dotnet#110

Comments

@gtwilliams03
Copy link

Describe the bug
I am loading our users task lists using the Graph API - during the PageIterator delegate, I am trying to add keys to each retrieved TodoTask AdditionalData dictionary. If I add only one key, it works fine. More than one key, it hangs.

To Reproduce
Steps to reproduce the behavior - see sample code below.

Expected behavior
I think it should allow me to add the additional keys?

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: N/A running in Visual Studio 2022
  • Version 2022

Additional context

                    var _items = new List<TodoTask>();
                    var _todoLists = await _graphClient.Users[_email].Todo.Lists.GetAsync();

                    foreach (TodoTaskList _todoTaskList in _todoLists.Value)
                    {
                        Console.WriteLine($@"List name: {_todoTaskList.DisplayName}");
                        try
                        {
                            var _todoListItems = await _graphClient.Users[_email].Todo.Lists[_todoTaskList.Id].Tasks.GetAsync();
                            var _pageIterator = PageIterator<TodoTask, TodoTaskCollectionResponse>
                                .CreatePageIterator(_graphClient, _todoListItems, (_todoListItem) => {

                                    if (_todoListItem.AdditionalData == null)
                                    {
                                        _todoListItem.AdditionalData = new Dictionary<string, object>();
                                    }

                                    _todoListItem.AdditionalData["ActualWork"] = 0.0;
                                   // _todoListItem.AdditionalData["TotalWork"] = 0.0; <-- uncommenting this line causes the delegate to hang
                                    _items.Add(_todoListItem);

                                    return true;

                                });
                            await _pageIterator.IterateAsync();
                        }
                        catch (Exception ex)
                        {
                            Console.WriteLine($@"Error getting task list {_todoTaskList.DisplayName}: {ex.Message}");
                        }
                    }

                    Console.WriteLine($@"Tasks loaded: {_items.Count}");

@ghost ghost added the Needs: Triage label Jun 29, 2023
@andrueastman
Copy link
Member

Thanks for raising this @gtwilliams03

Any chance you can share version of the SDK you are using when you reproduce this?

@ghost
Copy link

ghost commented Jul 3, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@gtwilliams03
Copy link
Author

I was using 5.15.0

@gtwilliams03
Copy link
Author

Updated to 5.17.0 and this still hangs.

@andrueastman
Copy link
Member

Thanks for confirming this @gtwilliams03

Any chance it completes if you limit the number of items in a page? We're currently looking into this.

var _todoListItems = await graphClient.Me.Todo.Lists[_todoTaskList.Id].Tasks.GetAsync( requestConfiguration => requestConfiguration.QueryParameters.Top = 10);

@gtwilliams03
Copy link
Author

@andrueastman I don't believe that will help because this hangs even for users with very few Todo tasks. I am currently traveling but will try your test when I get back next week if that is OK.

@gtwilliams03
Copy link
Author

@andrueastman Adding the following to the .GetAsync() call allows the call to complete with the custom fields added to the AdditionalData field:

requestConfiguration => requestConfiguration.QueryParameters.Top = 1

However, if I have the Top property to any value greater than 1, it hangs again.

@gtwilliams03
Copy link
Author

@andrueastman Hi! Any update on this issue?

@gtwilliams03
Copy link
Author

Updated to 5.20.0 and still get the error unless I have requestConfiguration => requestConfiguration.QueryParameters.Top = 1 in the GetAsync call.

@gtwilliams03
Copy link
Author

Still not working with 5.21.0

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

Successfully merging a pull request may close this issue.

2 participants