Skip to content

Commit f54409d

Browse files
committed
Remove unnecessary suppressions
Since previous versions, Visual Studio Validation has become smarter about a few cases, and thus some previous suppressions to avoid false positives are no longer necessary. This is notably the case for scenarios where an appropriate exception is being caught (e.g., `ArgumentException`), but previous versions mistook it as catching an overly broad exception. This resolves IDE0079.
1 parent 4838da8 commit f54409d

2 files changed

Lines changed: 1 addition & 7 deletions

File tree

OnTopic.TestDoubles/DummyTopicMappingService.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using OnTopic.Mapping.Annotations;
1111

1212
#pragma warning disable CS1998 // Async method lacks 'await' operators and will run synchronously
13-
#pragma warning disable IDE0060 // Remove unused parameter
1413

1514
namespace OnTopic.TestDoubles {
1615

@@ -57,5 +56,4 @@ public DummyTopicMappingService() {
5756
} //Class
5857
} //Namespace
5958

60-
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously
61-
#pragma warning restore IDE0060 // Remove unused parameter
59+
#pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously

OnTopic/Mapping/TopicMappingService.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,10 @@ void AddToList(object dto) {
665665
try {
666666
targetList.Add(dto);
667667
}
668-
#pragma warning disable CA1031 // Do not catch general exception types
669668
catch (ArgumentException) {
670669
//Ignore exceptions caused by duplicate keys, in case the IList represents a keyed collection
671670
//We would defensively check for this, except IList doesn't provide a suitable method to do so
672671
}
673-
#pragma warning restore CA1031 // Do not catch general exception types
674672
}
675673
}
676674

@@ -710,11 +708,9 @@ ConcurrentDictionary<int, object> cache
710708
try {
711709
topicDto = await MapAsync(source, configuration.CrawlRelationships, cache).ConfigureAwait(false);
712710
}
713-
#pragma warning disable CA1031 // Do not catch general exception types
714711
catch (InvalidOperationException) {
715712
//Disregard errors caused by unmapped view models; those are functionally equivalent to IsAssignableFrom() mismatches
716713
}
717-
#pragma warning restore CA1031 // Do not catch general exception types
718714
if (topicDto is not null && configuration.Property.PropertyType.IsAssignableFrom(topicDto.GetType())) {
719715
configuration.Property.SetValue(target, topicDto);
720716
}

0 commit comments

Comments
 (0)