Skip to content

Introduce [MSBuild]::StableStringHash overload(s) with alternative hashing #9519

@JanKrivanek

Description

@JanKrivanek

Blocked By

#9572
https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1937630

Context

#9387 introduced improved hashing for [MSBuild]::StableStringHash, that however broke internal functionality relying on the hash to be stable between versions (despite documented otherwise).

Proposal

The easiest way around it is to keep the current property function untouched, but introduce a new overload taking an enum argument:

<!-- Works unchanged -->
[MSBuild]::StableStringHash($x)

<!-- 
  $hashAlgo will currently allow:
    'GetHashCode' - the legacy behavior (mimicking string.GetHashCode)
    'FNV1a_32' - Fawler-Noll-Vo 1a 32bit
-->
[MSBuild]::StableStringHash($x, $hashAlgo)

This way other hashes (like xxHash) can be introduced in the future

Related

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions