[release/9.0-staging] Fix System.Reflection.Emit `SetChecksum` creating invalid pdb by github-actions[bot] · Pull Request #110205 · dotnet/runtime

Backport of #110097 to release/9.0-staging

Fixes #110096.

/cc @steveharter @tgjones

Customer Impact

  • Customer reported

This is preventing the use of PDBs with source document checksums that allow, for example, the source .cs file to be verified it has not been altered.

Regression

  • Yes
  • No

This code was introduced in v9 in this PR which had the bug.

Testing

This PR added the test.

Risk

Low. The fix is straightforward and one LOC.