mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
[PTRun]Fix crash when plugins have the same name (#15456)
This commit is contained in:
@@ -9,6 +9,10 @@ namespace PowerLauncher.Telemetry.Events
|
||||
[EventData]
|
||||
public class PluginModel
|
||||
{
|
||||
public string ID { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public bool Disabled { get; set; }
|
||||
|
||||
public bool IsGlobal { get; set; }
|
||||
|
||||
@@ -52,9 +52,13 @@ namespace PowerLauncher
|
||||
|
||||
private void SendSettingsTelemetry()
|
||||
{
|
||||
Log.Info("Send Run settings telemetry", this.GetType());
|
||||
var plugins = PluginManager.AllPlugins.ToDictionary(x => x.Metadata.Name, x => new PluginModel()
|
||||
try
|
||||
{
|
||||
Log.Info("Send Run settings telemetry", this.GetType());
|
||||
var plugins = PluginManager.AllPlugins.ToDictionary(x => x.Metadata.Name + " " + x.Metadata.ID, x => new PluginModel()
|
||||
{
|
||||
ID = x.Metadata.ID,
|
||||
Name = x.Metadata.Name,
|
||||
Disabled = x.Metadata.Disabled,
|
||||
ActionKeyword = x.Metadata.ActionKeyword,
|
||||
IsGlobal = x.Metadata.IsGlobal,
|
||||
@@ -63,6 +67,13 @@ namespace PowerLauncher
|
||||
var telemetryEvent = new RunPluginsSettingsEvent(plugins);
|
||||
PowerToysTelemetry.Log.WriteEvent(telemetryEvent);
|
||||
}
|
||||
#pragma warning disable CA1031 // Do not catch general exception types
|
||||
catch (Exception ex)
|
||||
#pragma warning restore CA1031 // Do not catch general exception types
|
||||
{
|
||||
Log.Exception("Unhandled exception when trying to send PowerToys Run settings telemetry.", ex, GetType());
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSourceInitialized(EventArgs e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user