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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

.Net: Add early return if Freeze method is called on a frozen object #5057

Merged
merged 3 commits into from
Feb 21, 2024

Conversation

Krzysztof318
Copy link
Contributor

@Krzysztof318 Krzysztof318 commented Feb 16, 2024

Motivation and Context

In PromptExecutionSettings is a bug which creates new ReadOnlyCollection even object is already freezed.

Description

The Freeze method in both PromptExecutionSettings and OpenAIPromptExecutionSettings classes now include an early return condition. This checks if the instance is already frozen, and if so, the method execution is immediately stopped. This improvement prevents unnecessary computations in these classes' Freeze methods.

Contribution Checklist

The `Freeze` method in both `PromptExecutionSettings` and `OpenAIPromptExecutionSettings` classes now include an early return condition. This checks if the instance is already frozen, and if so, the method execution is immediately stopped. This improvement prevents unnecessary computations in these classes' `Freeze` methods.
@Krzysztof318 Krzysztof318 requested a review from a team as a code owner February 16, 2024 18:16
@shawncal shawncal added .NET Issue or Pull requests regarding .NET code kernel Issues or pull requests impacting the core kernel kernel.core labels Feb 16, 2024
@github-actions github-actions bot changed the title Add early return if Freeze method is called on a frozen object .Net: Add early return if Freeze method is called on a frozen object Feb 16, 2024
@markwallace-microsoft markwallace-microsoft self-assigned this Feb 17, 2024
@dmytrostruk dmytrostruk added this pull request to the merge queue Feb 21, 2024
Merged via the queue into microsoft:main with commit f8e563a Feb 21, 2024
18 checks passed
@Krzysztof318 Krzysztof318 deleted the freezing-fix branch February 21, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kernel.core kernel Issues or pull requests impacting the core kernel .NET Issue or Pull requests regarding .NET code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants