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

Linker warnings from the AES code when publishing a NativeAOT application #664

Closed
Numpsy opened this issue Jul 24, 2023 · 4 comments
Closed

Comments

@Numpsy
Copy link
Contributor

Numpsy commented Jul 24, 2023

Hi,

I've been doing some tests with publishing some apps as NativeAOT to see what works and when I built an app that references PdfPig I noticed this in the build logs:

UglyToad.PdfPig.Encryption.EncryptionHandler.CalculateKeyRevisions5And6(Byte[],EncryptionDictionary,Boolean): Using member 'System.Security.Cryptography.Aes.Create(String)' which has 'RequiresUnreferencedCodeAttribute' can break functionality when trimming application code. The default algorithm implementations might be removed, use strong type references like 'RSA.Create()' instead.

And then I also notice that the MS docs at https://learn.microsoft.com/en-us/dotnet/api/system.security.cryptography.aes.create?view=net-7.0#system-security-cryptography-aes-create(system-string) say that that overload of Create has been obsoleted in .NET 7.
So I just wondered - is there a need to use that version of Create rather than the base one?

@BobLd
Copy link
Collaborator

BobLd commented Aug 1, 2023

I see other warning with ReflectionGraphicsStateOperationFactory and it actually prevent my NativeAOT to run. I'll give it a go with a PR soon

@Numpsy
Copy link
Contributor Author

Numpsy commented Jan 9, 2024

@BobLd The title issue with AES is hopefully fixed by #747, but do you want the issue left open for the ReflectionGraphicsStateOperationFactory one?

@BobLd
Copy link
Collaborator

BobLd commented Jan 9, 2024

@Numpsy I think we can close this one, as it was specific to aes. Thanks a lot for your help with that. I'll try to look into the other issues for Native AOT but any help would be appreciated 😁

@Numpsy
Copy link
Contributor Author

Numpsy commented Jan 10, 2024

I've done a bit in that area on other projects by adding attributes and such so I can have a look at some point, though I don't know when I'll have time.

For the record, you get warnings about the graphics code, and a similar one in AddPageFactory, as regular build warnings if you enable the EnableTrimAnalyzer property in the .net6.0 build, so maybe that's something to consider doing?

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

No branches or pull requests

2 participants