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

Unstable mvid when using signature file #14091

Closed
nojaf opened this issue Oct 12, 2022 · 4 comments
Closed

Unstable mvid when using signature file #14091

nojaf opened this issue Oct 12, 2022 · 4 comments
Assignees
Labels
Area-Compiler-CodeGen IlxGen, ilwrite and things at the backend Bug Feature Improvement Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone

Comments

@nojaf
Copy link
Contributor

nojaf commented Oct 12, 2022

When I have a project with a paired file (impl + sig), my reference assembly mvid should not change when I modify the implementation file where the signature did not change.
I think there are multiple situations where this happens.

Provide the steps required to reproduce the problem:
See https://github.com/nojaf/InstableMvid

Expected behaviour

The mvid should remain the same when the implementation was touched but the signature was not.

Actual behaviour

Adding a new class to the implementation only leads to another mvid value.

Known workarounds

I knew this could happen when you don't have signature files, so that was my whole reasoning for betting on them.

Related information

Provide any related information (optional):

  • dotnet 7.0.100-rc.2.22477.23

I'm very interested to contribute to this.
@TIHan could you point me in the right direction?

@nojaf
Copy link
Contributor Author

nojaf commented Oct 12, 2022

Could we do something with the

member IsHideBySig: bool

to generate the mvid value?

Or figure out on the ILTypeDef level if it was backed by a signature file?

@vzarytovskii
Copy link
Member

vzarytovskii commented Oct 12, 2022

Mvid depends on signature and optimization data, there's no "easy" fix for it.

This issue is pretty much a duplicate of #13222

@nojaf
Copy link
Contributor Author

nojaf commented Oct 12, 2022

Thinking out loud but if you know a file was backed by a signature, could you not trim code, data and meta for that file in

let hCode = sha.ComputeHash code
let hData = sha.ComputeHash data
let hMeta = sha.ComputeHash metadata
// Not yet suitable for the mvidsection optimization
let deterministicId = [| hCode; hData; hMeta |] |> Array.collect id |> sha.ComputeHash
let deterministicMvid () = deterministicId[0..15]

Well, I wouldn't trim the existing stuff, just collect less when you can, purely for the mvid value.
I'm aware of the complexity of trimming the sigdata in #12674. but doesn't that go away when a user has a signature file where it is explicitly stated what is public and what is not?
Where again, I'm not saying we should trim the existing data there today, just don't use the full set to determine the mvid.

@vzarytovskii
Copy link
Member

Thinking out loud but if you know a file was backed by a signature, could you not trim code, data and meta for that file in

let hCode = sha.ComputeHash code
let hData = sha.ComputeHash data
let hMeta = sha.ComputeHash metadata
// Not yet suitable for the mvidsection optimization
let deterministicId = [| hCode; hData; hMeta |] |> Array.collect id |> sha.ComputeHash
let deterministicMvid () = deterministicId[0..15]

Well, I wouldn't trim the existing stuff, just collect less when you can, purely for the mvid value.
I'm aware of the complexity of trimming the sigdata in #12674. but doesn't that go away when a user has a signature file where it is explicitly stated what is public and what is not?
Where again, I'm not saying we should trim the existing data there today, just don't use the full set to determine the mvid.

Tricky, we might want to experiment with it, however sigdata now has all members - internal and private.

I am unsure what will consequences of this be - how it is used by existing tooling (if at all).

@vzarytovskii vzarytovskii added this to the Backlog milestone Oct 17, 2022
@T-Gro T-Gro added Feature Improvement Area-Compiler-CodeGen IlxGen, ilwrite and things at the backend Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code. and removed Needs-Triage labels Nov 21, 2022
@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-Compiler-CodeGen IlxGen, ilwrite and things at the backend Bug Feature Improvement Impact-Medium (Internal MS Team use only) Describes an issue with moderate impact on existing code.
Projects
Archived in project
Development

No branches or pull requests

3 participants