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

Generate deterministic MVID for reference assemblies based on contents of the assembly #13222

Closed
vzarytovskii opened this issue Jun 1, 2022 · 2 comments
Assignees
Labels
Area-Build Everything related to building F# compiler, tooling and VS extension. Area-Compiler-CodeGen IlxGen, ilwrite and things at the backend Feature Improvement
Milestone

Comments

@vzarytovskii
Copy link
Member

Continuation of reference assembly work, initially done in #12334

Generate deterministic MVID for reference assemblies based on contents of the assembly where the content also includes signature and optimization data; basically SHA1 of the bytes of the entire assembly.

Note
We need to keep in mind, that we store some extra information in sigdata, which can affect MVID generation:

  • the metadata for "private" declarations in implementation files that don't have signature files
  • the metadata for "internal" declarations when there are no InternalsVisibleTo in the assembly

Related issue: #12746

@vzarytovskii vzarytovskii added Feature Improvement Area-Compiler-CodeGen IlxGen, ilwrite and things at the backend Area-Build Everything related to building F# compiler, tooling and VS extension. labels Jun 1, 2022
@vzarytovskii vzarytovskii added this to the Backlog milestone Jun 1, 2022
@nojaf
Copy link
Contributor

nojaf commented Jun 1, 2022

I could be wrong but is this not covered by

// Store the generated MVID in the environment (needed for generating debug information)
let modulGuid = if cenv.deterministic then deterministicGuid modul else newGuid modul
cenv.moduleGuid <- modulGuid

Or what would need to be updated there to make it compliant?

@vzarytovskii
Copy link
Member Author

vzarytovskii commented Jun 1, 2022

@nojaf

I could be wrong but is this not covered by

// Store the generated MVID in the environment (needed for generating debug information)
let modulGuid = if cenv.deterministic then deterministicGuid modul else newGuid modul
cenv.moduleGuid <- modulGuid

Or what would need to be updated there to make it compliant?

It is, but it also takes sigdata into account, and we generate some extra info in sigdata (private and internal members in certain cases), meaning MVID generation will be affected if private/internal members are getting changed, and will not be as effective.

Update: deterministicGuid by itself does not take anything other than name into account, we do update MVID afterwards here:

// Update MVID guid in metadata
Array.blit final 0 metadata guidStart 16

More info can be found here: #12746

@T-Gro T-Gro self-assigned this Apr 14, 2023
@T-Gro T-Gro modified the milestones: Backlog, April-2023 Apr 14, 2023
@vzarytovskii vzarytovskii removed this from the April-2023 milestone May 4, 2023
@T-Gro T-Gro added this to the May-2023 milestone May 4, 2023
@T-Gro T-Gro closed this as completed Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Build Everything related to building F# compiler, tooling and VS extension. Area-Compiler-CodeGen IlxGen, ilwrite and things at the backend Feature Improvement
Projects
Archived in project
Development

No branches or pull requests

3 participants