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

Make RandomNumberGenerator.Create return a singleton #52495

Merged
merged 2 commits into from
May 11, 2021

Conversation

GrabYourPitchforks
Copy link
Member

Inspired by #40169 and #52373. This makes the implementation of RandomNumberGenerator.Create() return a singleton instance. So apps which need to call RandomNumberGenerator.Create() instead of using the static accelerator APIs can still take advantage of a non-allocating factory.

Attempting to dispose of the returned singleton instance will no-op. The implementation of RandomNumberGenerator.Create(string) is not changed. Using that API will continue to go through the normal CryptoConfig activation code paths.

/cc @jeffhandley

@ghost
Copy link

ghost commented May 8, 2021

Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks
See info in area-owners.md if you want to be subscribed.

Issue Details

Inspired by #40169 and #52373. This makes the implementation of RandomNumberGenerator.Create() return a singleton instance. So apps which need to call RandomNumberGenerator.Create() instead of using the static accelerator APIs can still take advantage of a non-allocating factory.

Attempting to dispose of the returned singleton instance will no-op. The implementation of RandomNumberGenerator.Create(string) is not changed. Using that API will continue to go through the normal CryptoConfig activation code paths.

/cc @jeffhandley

Author: GrabYourPitchforks
Assignees: -
Labels:

area-System.Security

Milestone: 6.0.0

@bartonjs bartonjs merged commit abd9c96 into dotnet:main May 11, 2021
Copy link
Member

@stephentoub stephentoub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@ghost ghost locked as resolved and limited conversation to collaborators Jun 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants