private Guid CalculateMachineId() { lock (machineIdCalculationLock) { Guid guid = legacyApi.ReadSharedMachineId(); if (!(guid == default(Guid))) { return(guid); } string mACAddressHash = macInformationProvider.GetMACAddressHash(); if (mACAddressHash == null) { guid = Guid.NewGuid(); if (!legacyApi.SetSharedMachineId(guid)) { return(userInformationProvider.UserId); } return(guid); } guid = ConvertHexHashToGuid(mACAddressHash); legacyApi.SetSharedMachineId(guid); return(guid); } }
public void AddSharedProperties(List <KeyValuePair <string, object> > sharedProperties, TelemetryContext telemetryContext) { sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.MacAddressHash", macInformationProvider.GetMACAddressHash())); sharedProperties.Add(new KeyValuePair <string, object>("VS.Core.Machine.Id", machineInformationProvider.MachineId)); macInformationProvider.RunProcessIfNecessary(delegate(string macAddress) { telemetryContext.SharedProperties["VS.Core.MacAddressHash"] = macAddress; }); }