[NetAnalyzers]CA1031 suppressions cleanup (#18706)

This commit is contained in:
Davide Giacometti
2022-06-12 15:11:52 +02:00
committed by GitHub
parent 33072c7ee3
commit b33bc2ecd0
54 changed files with 0 additions and 143 deletions

View File

@@ -278,9 +278,7 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
{
UpdateUIThemeCallBack(GeneralSettingsConfig.Theme);
}
#pragma warning disable CA1031 // Do not catch general exception types
catch (Exception e)
#pragma warning restore CA1031 // Do not catch general exception types
{
Logger.LogError("Exception encountered when changing Settings theme", e);
}

View File

@@ -26,7 +26,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private Func<string, int> SendConfigMSG { get; }
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exceptions should not crash the program but will be logged until we can understand common exception scenarios")]
public ImageResizerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<string, string> resourceLoader)
{
_settingsUtils = settingsUtils ?? throw new ArgumentNullException(nameof(settingsUtils));

View File

@@ -47,7 +47,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private Func<List<KeysDataModel>, int> FilterRemapKeysList { get; }
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exceptions should not crash the program but will be logged until we can understand common exception scenarios")]
public KeyboardManagerViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, Func<List<KeysDataModel>, int> filterRemapKeysList)
{
if (settingsRepository == null)
@@ -200,7 +199,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
NativeMethods.SetForegroundWindow(handle);
}
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exceptions here (especially mutex errors) should not halt app execution, but they will be logged.")]
private void OpenEditor(int type)
{
try
@@ -236,7 +234,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
OnPropertyChanged(nameof(RemapShortcuts));
}
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exceptions here (especially mutex errors) should not halt app execution, but they will be logged.")]
public bool LoadProfile()
{
var success = true;

View File

@@ -26,7 +26,6 @@ namespace Microsoft.PowerToys.Settings.UI.Library.ViewModels
private Func<string, int> SendConfigMSG { get; }
[SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "Exceptions should not crash the program but will be logged until we can understand common exception scenarios")]
public PowerRenameViewModel(ISettingsUtils settingsUtils, ISettingsRepository<GeneralSettings> settingsRepository, Func<string, int> ipcMSGCallBackFunc, string configFileSubfolder = "")
{
// Update Settings file folder:

View File

@@ -53,9 +53,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
{
Settings = _settingsUtils.GetSettings<VideoConferenceSettings>(GetSettingsSubPath());
}
#pragma warning disable CA1031 // Do not catch general exception types
catch
#pragma warning restore CA1031 // Do not catch general exception types
{
Settings = new VideoConferenceSettings();
_settingsUtils.SaveSettings(Settings.ToJsonString(), GetSettingsSubPath());
@@ -177,9 +175,7 @@ namespace Microsoft.PowerToys.Settings.UI.ViewModels
RaisePropertyChanged(nameof(CameraImageOverlayPath));
}
}
#pragma warning disable CA1031 // Do not catch general exception types
catch
#pragma warning restore CA1031 // Do not catch general exception types
{
}
}