Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.

Remove use of DangerousGetPinnableReference and use Memory.GetReference instead#1985

Merged
ahsonkhan merged 2 commits into
dotnet:masterfrom
ahsonkhan:RemoveUseOfDanger
Dec 22, 2017
Merged

Remove use of DangerousGetPinnableReference and use Memory.GetReference instead#1985
ahsonkhan merged 2 commits into
dotnet:masterfrom
ahsonkhan:RemoveUseOfDanger

Conversation

@ahsonkhan
Copy link
Copy Markdown
Contributor

@ahsonkhan ahsonkhan commented Dec 17, 2017

Part of:
https://github.com/dotnet/corefx/issues/25412
https://github.com/dotnet/corefx/issues/25615

Depends on the following to go through first:
dotnet/corefx#25961 (and subsequent consumption of CoreFx libraries in CoreFxLab)

Cannot use method 'MemoryMarshal.GetReference(ReadOnlySpan)' as a ref or out value because it is a readonly variable

I didn't find any uses of DangerousTryGetArray to remove.

Following the staging plan from here: https://github.com/dotnet/corefx/issues/23881#issuecomment-343767740

  • Add MemoryExtensions.GetReference/TryGetArray
  • Convert all uses of DangerousGetPinnableReference/DangerousTryGetArray in coreclr, corefx, corert, corefxlab, aspnet, ... to MemoryExtensions.GetReference
  • Change DangerousGetPinnableReference to whatever we like to make it fit the pinning pattern and remove DangerousTryGetArray.

Doing it this way will avoid the need for complex staging or things being on the floor for extensive periods of time.

cc @jkotas, @stephentoub, @KrzysztofCwalina, @davidfowl, @pakrym, @joshfree, @eerhardt

@KrzysztofCwalina
Copy link
Copy Markdown
Member

@dotnet-bot test this please

1 similar comment
@ahsonkhan
Copy link
Copy Markdown
Contributor Author

@dotnet-bot test this please

@ahsonkhan ahsonkhan merged commit 1c979fa into dotnet:master Dec 22, 2017
@ahsonkhan ahsonkhan deleted the RemoveUseOfDanger branch December 22, 2017 20:44
KrzysztofCwalina pushed a commit to KrzysztofCwalina/corefxlab that referenced this pull request Jan 5, 2018
…ce instead (dotnet#1985)

* Remove use of DangerousGetPinnableReference and use Memory.GetReference instead

* Misses some references to DangerousGetPinnableReference in sample projects
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants