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

Obsoleting StrongNameKeyPair type in .NetCore #6343

Closed
buyaa-n opened this issue Apr 13, 2021 · 4 comments
Closed

Obsoleting StrongNameKeyPair type in .NetCore #6343

buyaa-n opened this issue Apr 13, 2021 · 4 comments
Labels
Milestone

Comments

@buyaa-n
Copy link

buyaa-n commented Apr 13, 2021

As part of dotnet/runtime#47228 we are obsoleting APIs not supported in .Net Core. The APIs we are obsoleting in reflection are listed in dotnet/runtime#50529. Where we found that System.Reflection.StrongNameKeyPair is not supported in .NetCore and existing APIs only throwing PNSE or no-op. We are planning to update the no-op constructor overloads to throw PNSE and [Obsolete] the entire type. Which also causing to Obsolete AssemblyName.KeyPair property. This type and API doesn't have real usage in runtime repo but from https://source.dot.net/ we see it is referenced a lot from MSBuild repo.

Please let us know if you have any issue with Obsoleting this type and API

Originally posted by @buyaa-n in dotnet/runtime#50941 (comment)

@buyaa-n
Copy link
Author

buyaa-n commented Apr 13, 2021

The Obsoletion will be added only into .Net 6. So if this type and API is not referenced from .Net 6 context then there will be no issue

@benvillalobos benvillalobos modified the milestones: Backlog, 17.0 Apr 14, 2021
@benvillalobos
Copy link
Member

rg StrongNameKeyPair

C:\src\git\msbuild>rg StrongNameKeyPair
src\Tasks\TlbReference.cs
232:                GetAndValidateStrongNameKey(out StrongNameKeyPair keyPair, out byte[] publicKey);

src\Tasks\StrongNameUtils.cs
32:        internal static void ReadKeyFile(TaskLoggingHelper log, string keyFile, out StrongNameKeyPair keyPair, out byte[] publicKey)
69:            var snp = new StrongNameKeyPair(keyFileContents);
90:        internal static void GetStrongNameKey(TaskLoggingHelper log, string keyFile, string keyContainer, out StrongNameKeyPair keyPair, out byte[] publicKey)
101:                    keyPair = new StrongNameKeyPair(keyContainer);

src\Tasks\AxTlbBaseReference.cs
249:        internal void GetAndValidateStrongNameKey(out StrongNameKeyPair keyPair, out byte[] publicKey)

src\Tasks\AxTlbBaseTask.cs
214:                StrongNameKeyPair keyPair;

src\Shared\TranslatorHelpers.cs
264:                    // AssemblyName.KeyPair is not used anywhere, additionally StrongNameKeyPair is not supported in .net core 5-

src\Shared\AssemblyNameExtension.cs
151:                var keyPair = (StrongNameKeyPair) info.GetValue("keypair", typeof(StrongNameKeyPair));

src\Build.UnitTests\BackEnd\BinaryTranslator_Tests.cs
548:                KeyPair = new StrongNameKeyPair(new byte[] { 4, 3, 2, 1 })

@rainersigwald
Copy link
Member

@buyaa-n We looked at this in triage. If we do reference it in .NET 5/6, we should be able to ifdef it out. Thanks for the heads up.

@buyaa-n
Copy link
Author

buyaa-n commented Apr 28, 2021

Thanks, @rainersigwald the PR for obsoleting StrongNameKeyPair is merged, closing the issue as no immediate action needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants