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

.Net: Bug: Sample code in GitHubPlugin.cs is not correct #10105

Closed
svandenhoven opened this issue Jan 7, 2025 · 0 comments · Fixed by #10123
Closed

.Net: Bug: Sample code in GitHubPlugin.cs is not correct #10105

svandenhoven opened this issue Jan 7, 2025 · 0 comments · Fixed by #10123
Assignees
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code

Comments

@svandenhoven
Copy link

Describe the bug
I am following the guidance in https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/examples/example-chat-agent?pivots=programming-language-csharp. This refers to https://github.com/microsoft/semantic-kernel/blob/08a41117c24cdd1f8f98332a222abc5b8f46ea0d/dotnet/samples/LearnResources/Plugins/GitHub/GitHubPlugin.cs as GitHubPlugin for the sample agent.
In line

HttpResponseMessage response = await client.GetAsync(new Uri(path));
there is code line:

HttpResponseMessage response = await client.GetAsync(new Uri(path));

This gives the error:

An exception of type 'System.UriFormatException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'Invalid URI: The format of the URI could not be determined.'

This is because the path has value ("/user") and this is indeed an invalid URI.

This can be solved by changing the line to

HttpResponseMessage response = await client.GetAsync(path);

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/examples/example-chat-agent?pivots=programming-language-csharp
  2. Follow the whole guidance
  3. Build and run the application and use message "What is my username?"
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.
The GET on the GitHub should be executed and the agent should answer with the username.

Screenshots
Image

Platform

  • OS: Windows
  • IDE: VS CODE
  • Language: c#
  • Source:

Additional context
Add any other context about the problem here.

@svandenhoven svandenhoven added the bug Something isn't working label Jan 7, 2025
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Jan 7, 2025
@github-actions github-actions bot changed the title Bug: Sample code in GitHubPlugin.cs is not correct .Net: Bug: Sample code in GitHubPlugin.cs is not correct Jan 7, 2025
@markwallace-microsoft markwallace-microsoft self-assigned this Jan 7, 2025
@markwallace-microsoft markwallace-microsoft moved this from Bug to Sprint: In Progress in Semantic Kernel Jan 8, 2025
@markwallace-microsoft markwallace-microsoft moved this from Sprint: In Progress to Sprint: In Review in Semantic Kernel Jan 8, 2025
github-merge-queue bot pushed a commit that referenced this issue Jan 8, 2025
### Motivation and Context

Closes #9264
Closes #10105 

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄
@markwallace-microsoft markwallace-microsoft moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working .NET Issue or Pull requests regarding .NET code
Projects
Status: Sprint: Done
Development

Successfully merging a pull request may close this issue.

2 participants