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]
|
[EventData]
|
||||||
public class PluginModel
|
public class PluginModel
|
||||||
{
|
{
|
||||||
|
public string ID { get; set; }
|
||||||
|
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
public bool Disabled { get; set; }
|
public bool Disabled { get; set; }
|
||||||
|
|
||||||
public bool IsGlobal { get; set; }
|
public bool IsGlobal { get; set; }
|
||||||
|
|||||||
@@ -52,16 +52,27 @@ namespace PowerLauncher
|
|||||||
|
|
||||||
private void SendSettingsTelemetry()
|
private void SendSettingsTelemetry()
|
||||||
{
|
{
|
||||||
Log.Info("Send Run settings telemetry", this.GetType());
|
try
|
||||||
var plugins = PluginManager.AllPlugins.ToDictionary(x => x.Metadata.Name, x => new PluginModel()
|
|
||||||
{
|
{
|
||||||
Disabled = x.Metadata.Disabled,
|
Log.Info("Send Run settings telemetry", this.GetType());
|
||||||
ActionKeyword = x.Metadata.ActionKeyword,
|
var plugins = PluginManager.AllPlugins.ToDictionary(x => x.Metadata.Name + " " + x.Metadata.ID, x => new PluginModel()
|
||||||
IsGlobal = x.Metadata.IsGlobal,
|
{
|
||||||
});
|
ID = x.Metadata.ID,
|
||||||
|
Name = x.Metadata.Name,
|
||||||
|
Disabled = x.Metadata.Disabled,
|
||||||
|
ActionKeyword = x.Metadata.ActionKeyword,
|
||||||
|
IsGlobal = x.Metadata.IsGlobal,
|
||||||
|
});
|
||||||
|
|
||||||
var telemetryEvent = new RunPluginsSettingsEvent(plugins);
|
var telemetryEvent = new RunPluginsSettingsEvent(plugins);
|
||||||
PowerToysTelemetry.Log.WriteEvent(telemetryEvent);
|
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)
|
protected override void OnSourceInitialized(EventArgs e)
|
||||||
|
|||||||
Reference in New Issue
Block a user