Enable trim analysis and fix warnings#1216
Conversation
| { | ||
| return _hash.ComputeHash(input); | ||
| #if !NET462 | ||
| using var hash = IncrementalHash.CreateHash(_hashAlgorithmName); |
There was a problem hiding this comment.
Would we benefit (performance wise) from creating the hash in the ctor and reusing it here.
Please create a small benchmark to help us decide.
There was a problem hiding this comment.
In addition to my other comment: this is a correctness fix, not a performance improvement. I would rather work on other things than to run a benchmark for such a change. Sorry for being blunt.
There was a problem hiding this comment.
So maybe let's move the hash creating to the constructor. What do you think? this is the last change and I will be able to merge it.
There was a problem hiding this comment.
Makes sense. Done
I don't know how IsTrimmable works with references (i.e. to SshNet.Security.Cryptography)
|
I will review this next week. |
| { | ||
| return _hash.ComputeHash(input); | ||
| #if !NET462 | ||
| using var hash = IncrementalHash.CreateHash(_hashAlgorithmName); |
There was a problem hiding this comment.
So maybe let's move the hash creating to the constructor. What do you think? this is the last change and I will be able to merge it.
|
This issue has been fixed in the 2024.0.0 version. |
While the library is not really so modern as to think about trimming and AOT, with the default behaviour to trim all assemblies when trimming an application we have seen issues such as #1167, and I believe #859 (comment) is related.
Fortunately it does not require many changes.