in src/common/Logging/MacAddressHash/MACInformationProvider.cs [71:117]
public string GetMacAddressHash()
{
string persistedValue = null;
string result = null;
// Check if VS already persisted a mac address hash in the registry
if (this._platform.IsWindows)
{
persistedValue = this._vsRegistryPropertyReader.GetProperty(MacAddressKey) as string;
if (ValidateMacAddressHash(persistedValue))
{
result = persistedValue;
// Persist the value in the client config so, if VS get uninstalled, we keep our deviceid.
PersistMacAddressHash(result);
return result;
}
}
// Check if VSCode is already persisting a mac address
persistedValue = this._vsCodeStorageReader.MachineId;
if (ValidateMacAddressHash(persistedValue))
{
result = persistedValue;
// Persist the value in the client config so, if VSCode get uninstalled, we keep our deviceid.
PersistMacAddressHash(result);
return result;
}
// Check if the ClientConfig has the mac address hash
persistedValue = this._clientConfig.GetProperty(MacAddressKey) as string;
if (ValidateMacAddressHash(persistedValue))
{
return persistedValue;
}
// We don't have any persisted mac hash
string computedHash = ComputeMacAddressHash();
if (ValidateMacAddressHash(computedHash))
{
PersistMacAddressHash(computedHash);
return computedHash;
}
// If anything fails return zero hash
return ZeroHash;
}