Skip to content

Commit

Permalink
Merge pull request #502 from MindscapeHQ/ph/remove-win32-dep
Browse files Browse the repository at this point in the history
Removed rando Microsoft.Win32.Registry dependency
  • Loading branch information
phillip-haydon authored Nov 28, 2023
2 parents 44575b6 + c1026bf commit 07e0de8
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 29 deletions.
3 changes: 3 additions & 0 deletions CHANGE-LOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Full Change Log for Raygun4Net.* packages

### v8.0.1
- Removed dependency on Microsoft.Win32.Registry for `Mindscape.Raygun4Net.NetCore.Common` package

### v8.0.0
- This release fixes the strong naming and ensures the Assembly version is fixed to the Major version

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#nullable enable
using System;
using System.Diagnostics;
using System.Linq;
using System.Runtime.InteropServices;
using Microsoft.Win32;

namespace Mindscape.Raygun4Net.EnvironmentProviders
{
Expand Down Expand Up @@ -38,19 +36,7 @@ public static string GetOSInformation()

private static string? GetForWindows()
{
string? productName = null;

var registryKey =
Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows NT\\CurrentVersion");
var result = registryKey?.GetValue("productName") as string;

if (result != null)
{
var osVersion = Environment.OSVersion.VersionString;
productName = $"{result} ({osVersion})";
}

return productName;
return RuntimeInformation.OSDescription;
}

private static string? GetForLinux()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#nullable enable
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using Microsoft.Win32;

namespace Mindscape.Raygun4Net.EnvironmentProviders
{
Expand Down Expand Up @@ -37,18 +37,7 @@ internal static class ProcessorProvider

private static string? GetOnWindows()
{
string? cpuName = null;

var processorNameKey = Registry.LocalMachine.OpenSubKey(@"HARDWARE\DESCRIPTION\System\CentralProcessor\0",
RegistryKeyPermissionCheck.ReadSubTree);

if (processorNameKey != null)
{
cpuName = (string)processorNameKey.GetValue("ProcessorNameString");
processorNameKey.Close();
}

return cpuName;
return Environment.GetEnvironmentVariable("PROCESSOR_IDENTIFIER");
}

private static string? GetOnLinux()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@
<ItemGroup>
<PackageReference Include="System.Runtime.Serialization.Primitives" Version="4.3.0"/>
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
</ItemGroup>
</Project>

0 comments on commit 07e0de8

Please sign in to comment.