Skip to content

Commit

Permalink
Revert "[Dev][Build] .NET 8 Upgrade (#1968)"
Browse files Browse the repository at this point in the history
This reverts commit 2f2ba18.
  • Loading branch information
Darren Hoehna committed Jan 19, 2024
1 parent 4c3ff6b commit 2a3c27e
Show file tree
Hide file tree
Showing 109 changed files with 246 additions and 253 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/DevHome-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
configuration: [Release, Debug]
platform: [x64, x86, arm64]
os: [windows-latest]
dotnet-version: ['8.0.x']
dotnet-version: ['6.0.x']
exclude:
- configuration: Debug
platform: x64
Expand Down Expand Up @@ -77,11 +77,11 @@ jobs:
- name: DevHome UnitTests
if: ${{ matrix.platform != 'arm64' }}
run: cmd /c "$env:VSDevTestCmd" /Platform:${{ matrix.platform }} test\\bin\\${{ matrix.platform }}\\${{ matrix.configuration }}\\net8.0-windows10.0.22000.0\\DevHome.Test.dll
run: cmd /c "$env:VSDevTestCmd" /Platform:${{ matrix.platform }} test\\bin\\${{ matrix.platform }}\\${{ matrix.configuration }}\\net6.0-windows10.0.22000.0\\DevHome.Test.dll

- name: Tools UnitTests
if: ${{ matrix.platform != 'arm64' }}
run: |
foreach ($UnitTestPath in (Get-ChildItem "tools\\*\\*UnitTest\\bin\\${{ matrix.platform }}\\${{ matrix.configuration }}\\net8.0-windows10.0.22000.0\\*.UnitTest.dll")) {
foreach ($UnitTestPath in (Get-ChildItem "tools\\*\\*UnitTest\\bin\\${{ matrix.platform }}\\${{ matrix.configuration }}\\net6.0-windows10.0.22000.0\\*.UnitTest.dll")) {
cmd /c "$env:VSDevTestCmd" /Platform:${{ matrix.platform }} $UnitTestPath.FullName
}
8 changes: 4 additions & 4 deletions CoreWidgetProvider/CoreWidgetProvider.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
<Nullable>enable</Nullable>
<CsWinRTEnabled>false</CsWinRTEnabled>
<Platforms>x86;x64;arm64</Platforms>
<RuntimeIdentifiers>win-x86;win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfileFullPath Condition="'$(BuildingInsideVisualStudio)' != 'True'">$(SolutionDir)\src\Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfileFullPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Management.Infrastructure" Version="3.0.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.3.49-beta">
<PackageReference Include="Microsoft.Management.Infrastructure" Version="2.0.0" />
<PackageReference Include="Microsoft.Windows.CsWin32" Version="0.2.206-beta">
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="8.0.0" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
11 changes: 3 additions & 8 deletions CoreWidgetProvider/Helpers/CPUStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class CPUStats : IDisposable
internal class CPUStats : IDisposable
{
// CPU counters
private readonly PerformanceCounter procPerf = new ("Processor Information", "% Processor Utility", "_Total");
private readonly PerformanceCounter procPerformance = new ("Processor Information", "% Processor Performance", "_Total");
private readonly PerformanceCounter procFrequency = new ("Processor Information", "Processor Frequency", "_Total");
private readonly Dictionary<Process, PerformanceCounter> cpuCounters = new ();

internal sealed class ProcessStats
internal class ProcessStats
{
public Process? Process { get; set; }

Expand All @@ -31,12 +31,7 @@ internal sealed class ProcessStats
public CPUStats()
{
CpuUsage = 0;
ProcessCPUStats =
[
new ProcessStats(),
new ProcessStats(),
new ProcessStats()
];
ProcessCPUStats = new ProcessStats[3] { new ProcessStats(), new ProcessStats(), new ProcessStats() };

InitCPUPerfCounters();
}
Expand Down
2 changes: 1 addition & 1 deletion CoreWidgetProvider/Helpers/ChartHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class ChartHelper
internal class ChartHelper
{
public enum ChartType
{
Expand Down
2 changes: 1 addition & 1 deletion CoreWidgetProvider/Helpers/DataManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class DataManager : IDisposable
internal class DataManager : IDisposable
{
private readonly SystemData systemData;
private readonly DataType dataType;
Expand Down
11 changes: 5 additions & 6 deletions CoreWidgetProvider/Helpers/GPUStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class GPUStats : IDisposable
internal class GPUStats : IDisposable
{
// GPU counters
private readonly Dictionary<int, List<PerformanceCounter>> gpuCounters = new ();

private readonly List<Data> stats = new ();

public sealed class Data
public class Data
{
public string? Name { get; set; }

Expand Down Expand Up @@ -79,13 +79,12 @@ public void GetGPUPerfCounters()
continue;
}

if (!gpuCounters.TryGetValue(phys, out var value))
if (!gpuCounters.ContainsKey(phys))
{
value = new ();
gpuCounters.Add(phys, value);
gpuCounters.Add(phys, new ());
}

value.Add(counter);
gpuCounters[phys].Add(counter);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions CoreWidgetProvider/Helpers/IconLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,13 @@ public class IconLoader
public static string GetIconAsBase64(string filename)
{
Log.Logger()?.ReportDebug(nameof(IconLoader), $"Asking for icon: {filename}");
if (!Base64ImageRegistry.TryGetValue(filename, out var value))
if (!Base64ImageRegistry.ContainsKey(filename))
{
value = ConvertIconToDataString(filename);
Base64ImageRegistry.Add(filename, value);
Base64ImageRegistry.Add(filename, ConvertIconToDataString(filename));
Log.Logger()?.ReportDebug(nameof(IconLoader), $"The icon {filename} was converted and is now stored.");
}

return value;
return Base64ImageRegistry[filename];
}

private static string ConvertIconToDataString(string fileName)
Expand Down
2 changes: 1 addition & 1 deletion CoreWidgetProvider/Helpers/MemoryStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class MemoryStats : IDisposable
internal class MemoryStats : IDisposable
{
private readonly PerformanceCounter memCommitted = new ("Memory", "Committed Bytes", string.Empty);
private readonly PerformanceCounter memCached = new ("Memory", "Cache Bytes", string.Empty);
Expand Down
8 changes: 4 additions & 4 deletions CoreWidgetProvider/Helpers/NetworkStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class NetworkStats : IDisposable
internal class NetworkStats : IDisposable
{
private readonly Dictionary<string, List<PerformanceCounter>> networkCounters = new ();

private Dictionary<string, Data> NetworkUsages { get; set; } = new Dictionary<string, Data>();

private Dictionary<string, List<float>> NetChartValues { get; set; } = new Dictionary<string, List<float>>();

public sealed class Data
public class Data
{
public float Usage
{
Expand Down Expand Up @@ -114,12 +114,12 @@ public Data GetNetworkUsage(int networkIndex)
}

var currNetworkName = NetChartValues.ElementAt(networkIndex).Key;
if (!NetworkUsages.TryGetValue(currNetworkName, out var value))
if (!NetworkUsages.ContainsKey(currNetworkName))
{
return new Data();
}

return value;
return NetworkUsages[currNetworkName];
}

public int GetPrevNetworkIndex(int networkIndex)
Expand Down
6 changes: 3 additions & 3 deletions CoreWidgetProvider/Helpers/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public static string ReplaceIdentifers(string str, string[] resourceIdentifiers,
// These are all the string identifiers that appear in widgets.
public static string[] GetWidgetResourceIdentifiers()
{
return
[
return new string[]
{
"Widget_Template/Loading",
"Widget_Template_Tooltip/Submit",
"SSH_Widget_Template/Name",
Expand Down Expand Up @@ -89,6 +89,6 @@ public static string[] GetWidgetResourceIdentifiers()
"CPUUsage_Widget_Template/End_Process",
"Widget_Template_Button/Save",
"Widget_Template_Button/Cancel",
];
};
}
}
2 changes: 1 addition & 1 deletion CoreWidgetProvider/Helpers/SystemData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace CoreWidgetProvider.Helpers;

internal sealed class SystemData : IDisposable
internal class SystemData : IDisposable
{
public static MemoryStats MemStats { get; set; } = new MemoryStats();

Expand Down
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Widgets/CoreWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ public virtual string GetData(WidgetPageState page)

protected string GetTemplateForPage(WidgetPageState page)
{
if (Template.TryGetValue(page, out var value))
if (Template.ContainsKey(page))
{
Log.Logger()?.ReportDebug(Name, ShortId, $"Using cached template for {page}");
return value;
return Template[page];
}

try
Expand Down
12 changes: 6 additions & 6 deletions CoreWidgetProvider/Widgets/SSHWalletWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@

namespace CoreWidgetProvider.Widgets;

internal sealed class SSHWalletWidget : CoreWidget
internal class SSHWalletWidget : CoreWidget
{
private static readonly string DefaultConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\.ssh\\config";
protected static readonly string DefaultConfigFile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\.ssh\\config";

private static readonly Regex HostRegex = new (@"^Host\s+(\S*)\s*$", RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Multiline);

private FileSystemWatcher? FileWatcher { get; set; }

private static readonly new string Name = nameof(SSHWalletWidget);
protected static readonly new string Name = nameof(SSHWalletWidget);

private string ConfigFile
protected string ConfigFile
{
get => State();

Expand Down Expand Up @@ -405,7 +405,7 @@ private void SetConfigure()
}
}

internal sealed class DataPayload
internal class DataPayload
{
public string? ConfigFile
{
Expand All @@ -415,6 +415,6 @@ internal sealed class DataPayload

[JsonSourceGenerationOptions(WriteIndented = true)]
[JsonSerializable(typeof(DataPayload))]
internal sealed partial class SourceGenerationContext : JsonSerializerContext
internal partial class SourceGenerationContext : JsonSerializerContext
{
}
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Widgets/SystemCPUUsageWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
using Microsoft.Windows.Widgets.Providers;

namespace CoreWidgetProvider.Widgets;
internal sealed class SystemCPUUsageWidget : CoreWidget, IDisposable
internal class SystemCPUUsageWidget : CoreWidget, IDisposable
{
private static Dictionary<string, string> Templates { get; set; } = new ();

private static readonly new string Name = nameof(SystemCPUUsageWidget);
protected static readonly new string Name = nameof(SystemCPUUsageWidget);

private readonly DataManager dataManager;

Expand Down
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Widgets/SystemGPUUsageWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
using Microsoft.Windows.Widgets.Providers;

namespace CoreWidgetProvider.Widgets;
internal sealed class SystemGPUUsageWidget : CoreWidget, IDisposable
internal class SystemGPUUsageWidget : CoreWidget, IDisposable
{
private static Dictionary<string, string> Templates { get; set; } = new ();

private static readonly new string Name = nameof(SystemGPUUsageWidget);
protected static readonly new string Name = nameof(SystemGPUUsageWidget);

private readonly DataManager dataManager;

Expand Down
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Widgets/SystemMemoryWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

namespace CoreWidgetProvider.Widgets;

internal sealed class SystemMemoryWidget : CoreWidget, IDisposable
internal class SystemMemoryWidget : CoreWidget, IDisposable
{
private static Dictionary<string, string> Templates { get; set; } = new ();

private static readonly new string Name = nameof(SystemMemoryWidget);
protected static readonly new string Name = nameof(SystemMemoryWidget);

private readonly DataManager dataManager;

Expand Down
4 changes: 2 additions & 2 deletions CoreWidgetProvider/Widgets/SystemNetworkUsageWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
using Microsoft.Windows.Widgets.Providers;

namespace CoreWidgetProvider.Widgets;
internal sealed class SystemNetworkUsageWidget : CoreWidget, IDisposable
internal class SystemNetworkUsageWidget : CoreWidget, IDisposable
{
private static Dictionary<string, string> Templates { get; set; } = new ();

private int networkIndex;

private static readonly new string Name = nameof(SystemNetworkUsageWidget);
protected static readonly new string Name = nameof(SystemNetworkUsageWidget);

private readonly DataManager dataManager;

Expand Down
2 changes: 1 addition & 1 deletion CoreWidgetProvider/Widgets/WidgetImplFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using Microsoft.Windows.Widgets.Providers;

namespace CoreWidgetProvider.Widgets;
internal sealed class WidgetImplFactory<T> : IWidgetImplFactory
internal class WidgetImplFactory<T> : IWidgetImplFactory
where T : WidgetImpl, new()
{
public WidgetImpl Create(WidgetContext widgetContext, string state)
Expand Down

0 comments on commit 2a3c27e

Please sign in to comment.