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

Error in Get Username From Recent Activity #613

Closed
9 tasks
miladso72 opened this issue Jun 26, 2024 · 0 comments
Closed
9 tasks

Error in Get Username From Recent Activity #613

miladso72 opened this issue Jun 26, 2024 · 0 comments

Comments

@miladso72
Copy link

Important note

  • You must fill this form! If you don't fill it, your issue will be close immediately.
  • Put an X character between [ ] that is related to your issue, like [x]
  • Please remove Important note from this form!
  • Don't remove other sections (unless it's unnecessarily, like Debug logs and Screenshots sections)!

I've:

Issue category

  • Bug
  • Feature Request
  • Missing Feature
  • Question
  • Not sure

Language

  • [x ] C#

Usage

  • [ x] Windows Form/Console app

Operating System

  • [ x] Windows

Debug logs

If your issue has an debug log, post it here, unless remove this section!

Describe your issue

Hi Ramtin Im Milad...
i have error when i want to get username from recent activity , can you help me ...
my code is :
`
var recentActivity = await api.UserProcessor.GetRecentActivityFeedAsync(PaginationParameters.Empty);
if (!recentActivity.Succeeded)
{
this.textBox1.Invoke((MethodInvoker)delegate () {
textBox1.AppendText($"Failed to fetch recent activity: {recentActivity.Info.Message}"+Environment.NewLine);
});
return;
}

        foreach (var item in recentActivity.Value.Items)
        {
            this.textBox1.Invoke((MethodInvoker)delegate ()
            {
                // Debugging: Log the ProfileId
                textBox1.AppendText($"ProfileId: {item.ProfileId}" + Environment.NewLine);
            });
            // Ensure ProfileId is valid
            if (item.ProfileId == 0)
            {
                this.textBox1.Invoke((MethodInvoker)delegate ()
                {
                    textBox1.AppendText("Invalid ProfileId: 0" + Environment.NewLine);
                });
                continue;
            }

            var userInfoResult = await api.UserProcessor.GetUserInfoByIdAsync(item.ProfileId);
            if (userInfoResult.Succeeded)
            {
                var username = userInfoResult.Value.Username;

                // Update UI on the main thread
                this.Invoke((MethodInvoker)delegate
                { 
                    textBox2.AppendText($"{username.ToString()}{Environment.NewLine}");
                    System.Threading.Thread.Sleep(5000);
                    textBox2.Text.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
                    System.Threading.Thread.Sleep(5000);
                    var usernames = textBox2.Lines.Distinct();
                   
                        foreach (var mmm in usernames)
                        {
                            txtresualtactivity.AppendText(mmm + Environment.NewLine);
                        }
                });
            }
            else
            {
                this.Invoke((MethodInvoker)delegate { 
                // Log or handle the error accordingly
                txtresualtactivity.AppendText($"Failed to fetch user info for ProfileId {item.ProfileId}: {userInfoResult.Info.Message}" + Environment.NewLine);
            });
        }
        

        var rnd = new Random();
            var delay = rnd.Next(10,20);
            await Task.Delay(TimeSpan.FromSeconds(delay));
        }

`

Screenshots

my error :
Failed to fetch user info for ProfileId 4260057505: Error converting value {null} to type 'System.Boolean'. Path 'user.auto_expand_chaining', line 1, position 1991.

ramtinak added a commit that referenced this issue Aug 23, 2024
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

2 participants