Skip to content

Commit

Permalink
Merge pull request #3973 from microsoft/main
Browse files Browse the repository at this point in the history
Staging - 11/11/24
  • Loading branch information
krschau authored Nov 11, 2024
2 parents 3f7f971 + 0f16c44 commit 7e3e02e
Show file tree
Hide file tree
Showing 456 changed files with 386 additions and 50,831 deletions.
375 changes: 0 additions & 375 deletions DevHome.sln

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PlatformTarget>$(Platform)</PlatformTarget>
<ErrorOnDuplicatePublishOutputFiles>false</ErrorOnDuplicatePublishOutputFiles>
<Configurations>Debug;Release;Debug_FailFast</Configurations>
<WindowsSdkPackageVersion>10.0.22621.34</WindowsSdkPackageVersion>
</PropertyGroup>

<!--
Expand Down
13 changes: 0 additions & 13 deletions common/Contracts/IQuickstartSetupService.cs

This file was deleted.

88 changes: 88 additions & 0 deletions common/Helpers/GPOHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using Microsoft.Win32;
using Serilog;

namespace DevHome.Common.Helpers;

public class GPOHelper
{
private static readonly ILogger _log = Log.ForContext("SourceContext", nameof(GPOHelper));

private enum GpoRuleConfigured
{
WrongValue = -3, // The policy is set to an unrecognized value
Unavailable = -2, // Couldn't access registry
NotConfigured = -1, // Policy is not configured
Disabled = 0, // Policy is disabled
Enabled = 1, // Policy is enabled
}

// Registry path where gpo policy values are stored
private const string PoliciesScopeMachine = "HKEY_LOCAL_MACHINE";
private const string PoliciesPath = @"\SOFTWARE\Policies\DevHome";

// Registry value names
private const string PolicyConfigureEnabledDevHome = "ConfigureEnabledDevHome";

private static GpoRuleConfigured GetConfiguredValue(string registryValueName)
{
try
{
var rawValue = Registry.GetValue(
keyName: PoliciesScopeMachine + PoliciesPath,
valueName: registryValueName,
defaultValue: GpoRuleConfigured.NotConfigured);

_log.Error($"Registry value {registryValueName} set to {rawValue}");

// Value will be null if the subkey specified by keyName does not exist.
if (rawValue == null)
{
return GpoRuleConfigured.NotConfigured;
}
else if (rawValue is not int && rawValue is not GpoRuleConfigured)
{
return GpoRuleConfigured.WrongValue;
}
else
{
return (GpoRuleConfigured)rawValue;
}
}
catch (System.Security.SecurityException)
{
// The user does not have the permissions required to read from the registry key.
return GpoRuleConfigured.Unavailable;
}
catch (System.IO.IOException)
{
// The RegistryKey that contains the specified value has been marked for deletion.
return GpoRuleConfigured.Unavailable;
}
catch (System.ArgumentException)
{
// keyName does not begin with a valid registry root.
return GpoRuleConfigured.NotConfigured;
}
}

private static bool EvaluateConfiguredValue(string registryValueName, GpoRuleConfigured defaultValue)
{
var configuredValue = GetConfiguredValue(registryValueName);
if (configuredValue < 0)
{
_log.Error($"Registry value {registryValueName} set to {configuredValue}, using default {defaultValue} instead.");
configuredValue = defaultValue;
}

return configuredValue == GpoRuleConfigured.Enabled;
}

public static bool GetConfiguredEnabledDevHomeValue()
{
var defaultValue = GpoRuleConfigured.Enabled;
return EvaluateConfiguredValue(PolicyConfigureEnabledDevHome, defaultValue);
}
}
12 changes: 0 additions & 12 deletions common/Models/ExperimentalFeature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ public partial class ExperimentalFeature : ObservableObject

public static ILocalSettingsService? LocalSettingsService { get; set; }

public static IQuickstartSetupService? QuickstartSetupService { get; set; }

public ExperimentalFeature(string id, bool enabledByDefault, bool needsFeaturePresenceCheck, string openPageKey, string openPageParameter, bool visible = true)
{
Id = id;
Expand Down Expand Up @@ -85,16 +83,6 @@ public async Task OnToggledAsync()
await LocalSettingsService!.SaveSettingAsync($"IsSeeker", true);

TelemetryFactory.Get<ITelemetry>().Log("ExperimentalFeature_Toggled_Event", LogLevel.Critical, new ExperimentalFeatureEvent(Id, IsEnabled));

// To simplify setup for the Quickstart experimental feature, install the associated Dev Home Azure Extension if it's not already present
// when that feature is enabled. Those operations will only occur on Canary and Stable builds of Dev Home.
if (string.Equals(Id, "QuickstartPlayground", StringComparison.Ordinal) && IsEnabled)
{
if (!QuickstartSetupService!.IsDevHomeAzureExtensionInstalled())
{
await QuickstartSetupService!.InstallDevHomeAzureExtensionAsync();
}
}
}

[RelayCommand]
Expand Down
1 change: 0 additions & 1 deletion common/Services/INavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ public static class KnownPageKeys
{
public static readonly string Dashboard = "DevHome.Dashboard.ViewModels.DashboardViewModel";
public static readonly string Extensions = "DevHome.ExtensionLibrary.ViewModels.ExtensionLibraryViewModel";
public static readonly string WhatsNew = "DevHome.ViewModels.WhatsNewViewModel";
public static readonly string Settings = "DevHome.Settings.ViewModels.SettingsViewModel";
public static readonly string Feedback = "DevHome.Settings.ViewModels.FeedbackViewModel";
public static readonly string Environments = "DevHome.Environments.ViewModels.LandingPageViewModel";
Expand Down
53 changes: 0 additions & 53 deletions common/Services/QuickstartSetupService.cs

This file was deleted.

4 changes: 1 addition & 3 deletions common/TelemetryEvents/DeveloperId/EntryPointEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ public enum EntryPoint
None = 0,
Settings = 1,
SetupFlow = 2,
WhatsNewPage = 3,
Widget = 4,
Widget = 3,
}

private readonly string[] _entryPointNames =
[
string.Empty,
"Settings",
"SetupFlow",
"WhatsNewPage",
"Widget",
];

Expand Down
47 changes: 47 additions & 0 deletions common/TelemetryEvents/GitExtension/GitDetectEvent.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.

using System;
using System.Diagnostics.Tracing;
using DevHome.Telemetry;
using Microsoft.Diagnostics.Telemetry;
using Microsoft.Diagnostics.Telemetry.Internal;

namespace DevHome.Common.TelemetryEvents.GitExtension;

// How git.exe was located
public enum GitDetectStatus
{
// git.exe was not found on the system
NotFound,

// In the PATH environment variable
PathEnvironmentVariable,

// Probed well-known registry keys to find a Git install location
RegistryProbe,

// Probed well-known folders under Program Files [(x86)]
ProgramFiles,
}

[EventData]
public class GitDetectEvent : EventBase
{
public override PartA_PrivTags PartA_PrivTags => PrivTags.ProductAndServicePerformance;

public string Status { get; }

public string Version { get; }

public GitDetectEvent(GitDetectStatus status, string version)
{
Status = status.ToString();
Version = version;
}

public override void ReplaceSensitiveStrings(Func<string, string> replaceSensitiveStrings)
{
// This event so far has no sensitive strings
}
}

This file was deleted.

This file was deleted.

This file was deleted.

5 changes: 0 additions & 5 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ graph TD;
DevHome.Dashboard-->DevHome;
DevHome.Experiments-->DevHome;
DevHome.ExtensionLibrary-->DevHome;
DevHome.DevInsights-->DevHome.Service;
DevHome.Settings-->DevHome;
DevHome.SetupFlow-->DevHome;
DevHome.RepositoryManagement-->DevHome
Expand Down Expand Up @@ -70,10 +69,6 @@ Dev Home Common also provides telemetry functionality.

This is a special component that acts similarly to a tool but isn't actually a tool. The Settings component, like other tools, consumes the Common project and is used by Dev Home Core. It manages user preferences across all tools and extensions.

## Service

This is an NT service which runs as local system that provides functionality to various DevHome components. This functionality would typically require elevation and isn't transactional in nature. For items in DevHome that require elevation and are of a transactional nature, helper utilities are launched elevated instead.

## Tools

The tools are a set of functionalities that are integrated within Dev Home's codebase. They are designed to provide specific capabilities or features to Dev Home. They live as their own component but run in the same process as Dev Home and can communicate with each other and the core component through Dev Home's API.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ properties:
module: Microsoft.WinGet.DSC
allowPrerelease: true
settings:
id: Microsoft.GDK.2303
id: Microsoft.Gaming.GDK
source: winget
configurationVersion: 0.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class GitConfiguration : IDisposable

private string GitExeInstallPath { get; set; } = string.Empty;

private readonly object _fileLock = new();
private static readonly object _fileLock = new();

private readonly ILogger _log = Log.ForContext<GitDetect>();

Expand Down
Loading

0 comments on commit 7e3e02e

Please sign in to comment.