Fix:SemanticKernelQuickStart for c# #206
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixing Microsofts Semantic Kernel Lights Demo
1. Adding Required attribute to LightModel Class Property Name
Issue:
Non-nullable property 'Name' must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring the property as nullable.CS8618
Proposal
LightsPlugin.cs - Line: 46
Original:
Updated:
Why:
String property name must not allow null
2. Providing Null forgiving operator to UserInput
Issue:
Possible null reference argument for parameter 'content' in 'void ChatHistory.AddUserMessage(string content)'.CS8604
Proposal
Program.cs - Line: 43
Original:
Updated:
Why:
While loop condition prevents userInput from being null, therefore we can provide a null forgiving operator at line 43.
3. Unecessary Async functions
Issue:
This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.CS1998
Proposal
Program.cs - Line: 17 - 38
Original:
Updated:
Why:
We should await for task completion within our async function
4. Simplifying collection initialization - .NET clean code standards
Collection initialization can be simplified IDE0028
Proposal
(LightsPluginFileName).cs - Line: 8 - 13
Original
Updated
Why:
Simplifying collection initialization