Repository: microsoft/terminal (language: cpp)

Issue:
PGO not working due to Y2K22 bug
When the new year rolled over, the PGO Nuget no longer worked.

This is because NuGet.exe uses a SIGNED 32bit integer to represent version information.

However, this system was building the version number out of today's date and time.

When we hit 2022... we ended up with something that was over 21billion and therefore outside the limits of a 32 bit signed integer.

The solution is to move the version information with the date into the freeform text portion of the version (the prerelease field of Nuget packages) and set the previous one to a fixed number (and update our detection scripts to compensate for which package is the newest)


Discussion / hints:

Fix patch:
diff --git a/build/packages.config b/build/packages.config
index 34e0e10c1c9..7b2f271d521 100644
--- a/build/packages.config
+++ b/build/packages.config
@@ -2,5 +2,5 @@
 <packages>
   <package id="MUXCustomBuildTasks" version="1.0.48" targetFramework="native" />
   <package id="Microsoft.Taef" version="10.60.210621002" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/build/pgo/Terminal.PGO.props b/build/pgo/Terminal.PGO.props
index 1e82c2305d4..55a5e39f4d8 100644
--- a/build/pgo/Terminal.PGO.props
+++ b/build/pgo/Terminal.PGO.props
@@ -1,7 +1,7 @@
 <Project>
   <PropertyGroup>
     <NuGetPackageDirectory>$(MSBuildThisFileDirectory)..\..\packages</NuGetPackageDirectory>
-    <PkgMicrosoft_PGO_Helpers_Cpp>$(NuGetPackageDirectory)\Microsoft.PGO-Helpers.Cpp.0.2.22</PkgMicrosoft_PGO_Helpers_Cpp>
+    <PkgMicrosoft_PGO_Helpers_Cpp>$(NuGetPackageDirectory)\Microsoft.Internal.PGO-Helpers.Cpp.0.2.34</PkgMicrosoft_PGO_Helpers_Cpp>
   </PropertyGroup>
 
   <!-- Get version information -->
@@ -20,6 +20,12 @@
     <!-- Mandatory.  Minor version number of the PGO database which should match the version of the product.  This can be hardcoded or obtained from other sources in build system. -->
     <PGOPackageVersionMinor>$(VersionMinor)</PGOPackageVersionMinor>
 
+    <!-- Mandatory, defaults to 0.  Patch version number of the PGO database which should match the version of the product.  This can be hardcoded or obtained from other sources in build system. -->
+    <PGOPackageVersionPatch>0</PGOPackageVersionPatch>
+    
+    <!-- Optional, defaults to empty.  Prerelease version number of the PGO database which should match the version of the product.  This can be hardcoded or obtained from other sources in build system. -->
+    <PGOPackageVersionPrerelease></PGOPackageVersionPrerelease>
+
     <!-- Mandatory.  Path to nuget.config file for the project.  Path is relative to where the props file will be. -->
     <PGONuGetConfigPath>$(MSBuildThisFileDirectory)..\..\nuget.config</PGONuGetConfigPath>
 
diff --git a/src/cascadia/Remoting/packages.config b/src/cascadia/Remoting/packages.config
index 2d79f9f5adb..64e09e4c8e5 100644
--- a/src/cascadia/Remoting/packages.config
+++ b/src/cascadia/Remoting/packages.config
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/cascadia/TerminalApp/packages.config b/src/cascadia/TerminalApp/packages.config
index aece6932a3b..e039fa4ae47 100644
--- a/src/cascadia/TerminalApp/packages.config
+++ b/src/cascadia/TerminalApp/packages.config
@@ -3,5 +3,5 @@
   <package id="Microsoft.Toolkit.Win32.UI.XamlApplication" version="6.1.3" targetFramework="native" />
   <package id="Microsoft.UI.Xaml" version="2.7.0-prerelease.210913003" targetFramework="native" />
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/cascadia/TerminalConnection/packages.config b/src/cascadia/TerminalConnection/packages.config
index 5691dc1ad15..18ba2c234dc 100644
--- a/src/cascadia/TerminalConnection/packages.config
+++ b/src/cascadia/TerminalConnection/packages.config
@@ -2,5 +2,5 @@
 <packages>
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
   <package id="vcpkg-cpprestsdk" version="2.10.14" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/cascadia/TerminalControl/packages.config b/src/cascadia/TerminalControl/packages.config
index 2d79f9f5adb..64e09e4c8e5 100644
--- a/src/cascadia/TerminalControl/packages.config
+++ b/src/cascadia/TerminalControl/packages.config
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/cascadia/TerminalSettingsEditor/packages.config b/src/cascadia/TerminalSettingsEditor/packages.config
index 4c9a3d9eb78..44d99225891 100644
--- a/src/cascadia/TerminalSettingsEditor/packages.config
+++ b/src/cascadia/TerminalSettingsEditor/packages.config
@@ -2,5 +2,5 @@
 <packages>
   <package id="Microsoft.UI.Xaml" version="2.7.0-prerelease.210913003" targetFramework="native" />
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/cascadia/TerminalSettingsModel/packages.config b/src/cascadia/TerminalSettingsModel/packages.config
index aec7d47bd1d..2ecd2492264 100644
--- a/src/cascadia/TerminalSettingsModel/packages.config
+++ b/src/cascadia/TerminalSettingsModel/packages.config
@@ -2,5 +2,5 @@
 <packages>
   <package id="Microsoft.VisualStudio.Setup.Configuration.Native" version="2.3.2262" targetFramework="native" developmentDependency="true" />
   <package id="Microsoft.Windows.CppWinRT" version="2.0.210825.3" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/cascadia/WindowsTerminal/packages.config b/src/cascadia/WindowsTerminal/packages.config
index db0dcb51618..39685454320 100644
--- a/src/cascadia/WindowsTerminal/packages.config
+++ b/src/cascadia/WindowsTerminal/packages.config
@@ -5,5 +5,5 @@
   <package id="Microsoft.UI.Xaml" version="2.7.0-prerelease.210913003" targetFramework="native" />
   <package id="Microsoft.VCRTForwarders.140" version="1.0.4" targetFramework="native" />
   <package id="Microsoft.Internal.Windows.Terminal.ThemeHelpers" version="0.4.210908001" targetFramework="native" />
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
diff --git a/src/host/exe/packages.config b/src/host/exe/packages.config
index 947b5d6d65b..9e477b65215 100644
--- a/src/host/exe/packages.config
+++ b/src/host/exe/packages.config
@@ -1,4 +1,4 @@
 ﻿<?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="Microsoft.PGO-Helpers.Cpp" version="0.2.22" targetFramework="native" />
+  <package id="Microsoft.Internal.PGO-Helpers.Cpp" version="0.2.34" targetFramework="native" />
 </packages>
\ No newline at end of file


Test patch: