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: SemanticKernel package was not working in Winforms .NetFramework. #9755

Open
ChidanandMurugaiah opened this issue Nov 19, 2024 · 3 comments
Assignees
Labels
bug Something isn't working follow up Issues that require a follow up from the community. .NET Issue or Pull requests regarding .NET code

Comments

@ChidanandMurugaiah
Copy link

ChidanandMurugaiah commented Nov 19, 2024

Describe the bug

We are utilizing the Microsoft.SemanticKernel package in a .NET Framework 4.8 Winforms sample to retrieve responses from ChatGPT. However, when invoking kernel.GetRequiredService(), it consistently returns null. As a result, we are unable to use the ChatCompletionService to fetch AI responses. Notably, the same code functions correctly in a .NET80 environment.

To Reproduce
Steps to reproduce the behavior:

  1. Run the sample
  2. Click Initialize button

Expected behavior
Sample needs to be run properly without exception.

Screenshots
Image

Sample Link - SemanticKernel (2).zip

Platform

  • OS:Windows 11
  • IDE: VS2022 version 17.12.0
  • Language: C#
  • Source:Microsoft.SemanticKernel package version 1.21.1

Additional context
We saw that this package was compatible for WPF .NetFramework.

@ChidanandMurugaiah ChidanandMurugaiah added the bug Something isn't working label Nov 19, 2024
@markwallace-microsoft markwallace-microsoft added .NET Issue or Pull requests regarding .NET code triage labels Nov 19, 2024
@github-actions github-actions bot changed the title SemanticKernel package was not working in Winforms .NetFramework. .Net: SemanticKernel package was not working in Winforms .NetFramework. Nov 19, 2024
@RogerBarreto
Copy link
Member

RogerBarreto commented Nov 19, 2024

@ChidanandMurugaiah, can you check if this works with our latest version? 1.29

Please provide more details about the stack trace you getting.

We had a bug 1 month ago related to Null reference exception when using function calling and can be related to your example

@ChidanandMurugaiah
Copy link
Author

@RogerBarreto,

1) can you check if this works with our latest version? 1.29

  • When we try to install the latest version of the KS package we are facing the below issue.
    Image

2) Please provide more details about the stack trace you getting.

Below is the Stack trace

at Microsoft.SemanticKernel.ChatCompletion.ChatCompletionServiceExtensions.GetChatMessageContentsAsync(IChatCompletionService chatCompletionService, String prompt, PromptExecutionSettings executionSettings, Kernel kernel, CancellationToken cancellationToken)
at Microsoft.SemanticKernel.ChatCompletion.ChatCompletionServiceExtensions.d__1.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at SemanticKernel.AIService.d__10.MoveNext() in D:\Samples\Winforms\SemanticKernel\Form1.cs:line 57


3) We had a bug 1 month ago related to Null reference exception when using function calling and can be related to your example

#9313

  • We referred the query you mentioned but it was not similar to our problem. The same code works in .Net80 sample but not works in .NetFramework sample.

@RogerBarreto
Copy link
Member

RogerBarreto commented Nov 21, 2024

@ChidanandMurugaiah Thanks for the added context.

For the first item to successfully install in .Net Framework you need to download those dependencies manually because they are still in pre-release state.

Go to nuget package and download the Microsoft.Extensions.VectorData.Abstractions before installing SemanticKernel package and you will succeed.

Image

If the error persists for our latest version let me know and feel free to close this issue if the problem is solved.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working follow up Issues that require a follow up from the community. .NET Issue or Pull requests regarding .NET code
Projects
Status: Bug
Development

No branches or pull requests

3 participants