diff --git a/.globalconfig b/.globalconfig
index 89555f9d4..0a25db838 100644
--- a/.globalconfig
+++ b/.globalconfig
@@ -50,6 +50,30 @@ dotnet_diagnostic.IDE1006.severity = warning
# Too many noisy warnings for parsing/formatting numbers
dotnet_diagnostic.CA1305.severity = none
+# CA1806: Do not ignore method results
+# Not sure why it's performance, but causing too much noise
+dotnet_diagnostic.CA1806.severity = none
+
+# CA1822: Mark members as static
+# Potential false positive around reflection/too much noise
+dotnet_diagnostic.CA1822.severity = none
+
+# CA1826: Do not use Enumerable methods on indexable collections
+# Noise for FirstOrDefault and LastOrDefault
+dotnet_diagnostic.CA1826.severity = none
+
+# CA1859: Use concrete types when possible for improved performance
+# Involves design considerations
+dotnet_diagnostic.CA1859.severity = none
+
+# CA1861: Avoid constant arrays as arguments
+# Outdated with collection expressions
+dotnet_diagnostic.CA1861.severity = none
+
+# CA1868: Unnecessary call to 'Contains(item)'
+# Causing noises only
+dotnet_diagnostic.CA1868.severity = none
+
# CA2007: Consider calling ConfigureAwait on the awaited task
dotnet_diagnostic.CA2007.severity = warning
diff --git a/Directory.Build.props b/Directory.Build.props
index 43c761059..015096d9f 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -34,6 +34,8 @@
Recommended
Recommended
Recommended
+ Default
+ Minimum
ppy Pty Ltd
diff --git a/osu.Framework.Tests/Audio/AudioThreadTest.cs b/osu.Framework.Tests/Audio/AudioThreadTest.cs
index dd85628fd..5919c3405 100644
--- a/osu.Framework.Tests/Audio/AudioThreadTest.cs
+++ b/osu.Framework.Tests/Audio/AudioThreadTest.cs
@@ -8,6 +8,7 @@ using System.Threading;
using System.Threading.Tasks;
using NUnit.Framework;
using osu.Framework.Audio.Track;
+using osu.Framework.Extensions;
using osu.Framework.IO.Stores;
using osu.Framework.Threading;
@@ -87,7 +88,7 @@ namespace osu.Framework.Tests.Audio
runScheduled();
- Task.WaitAll(cts.Task);
+ cts.Task.WaitSafely();
}
}
}
diff --git a/osu.Framework.Tests/Containers/TestSceneContainerState.cs b/osu.Framework.Tests/Containers/TestSceneContainerState.cs
index 6d40f21b7..9107e0508 100644
--- a/osu.Framework.Tests/Containers/TestSceneContainerState.cs
+++ b/osu.Framework.Tests/Containers/TestSceneContainerState.cs
@@ -16,6 +16,8 @@ using osu.Framework.Testing;
using osu.Framework.Tests.Visual;
using osuTK;
+#pragma warning disable CA1826 // Performance for test is not important
+
namespace osu.Framework.Tests.Containers
{
[System.ComponentModel.Description("ensure valid container state in various scenarios")]
diff --git a/osu.Framework.Tests/Visual/UserInterface/TestSceneTabControl.cs b/osu.Framework.Tests/Visual/UserInterface/TestSceneTabControl.cs
index c83d51df5..f265370e3 100644
--- a/osu.Framework.Tests/Visual/UserInterface/TestSceneTabControl.cs
+++ b/osu.Framework.Tests/Visual/UserInterface/TestSceneTabControl.cs
@@ -17,6 +17,8 @@ using osu.Framework.Input;
using osu.Framework.Localisation;
using osuTK;
+#pragma warning disable CA1826 // Performance for test is not important
+
namespace osu.Framework.Tests.Visual.UserInterface
{
public partial class TestSceneTabControl : FrameworkTestScene
diff --git a/osu.Framework/Graphics/Containers/FlowContainer.cs b/osu.Framework/Graphics/Containers/FlowContainer.cs
index 4e78fe87e..ab0d79287 100644
--- a/osu.Framework/Graphics/Containers/FlowContainer.cs
+++ b/osu.Framework/Graphics/Containers/FlowContainer.cs
@@ -137,10 +137,10 @@ namespace osu.Framework.Graphics.Containers
/// The position of the drawable in the layout.
public float GetLayoutPosition(Drawable drawable)
{
- if (!layoutChildren.ContainsKey(drawable))
+ if (!layoutChildren.TryGetValue(drawable, out float value))
throw new InvalidOperationException($"Cannot get layout position of drawable which is not contained within this {nameof(FlowContainer)}.");
- return layoutChildren[drawable];
+ return value;
}
protected override bool UpdateChildrenLife()
diff --git a/osu.Framework/Graphics/Containers/SearchContainer.cs b/osu.Framework/Graphics/Containers/SearchContainer.cs
index e9de9e7e4..db5322d3b 100644
--- a/osu.Framework/Graphics/Containers/SearchContainer.cs
+++ b/osu.Framework/Graphics/Containers/SearchContainer.cs
@@ -79,7 +79,7 @@ namespace osu.Framework.Graphics.Containers
private LocalisationManager localisation { get; set; }
private readonly Cached filterValid = new Cached();
- private readonly ICollection> canBeShownBindables = new List>();
+ private readonly List> canBeShownBindables = new List>();
protected override void AddInternal(Drawable drawable)
{
diff --git a/osu.Framework/Input/Handlers/Midi/MidiHandler.cs b/osu.Framework/Input/Handlers/Midi/MidiHandler.cs
index c414f98e0..b388abc18 100644
--- a/osu.Framework/Input/Handlers/Midi/MidiHandler.cs
+++ b/osu.Framework/Input/Handlers/Midi/MidiHandler.cs
@@ -182,10 +182,10 @@ namespace osu.Framework.Input.Handlers.Midi
// need running status to be interpreted correctly
if (statusType <= 0x7F)
{
- if (!runningStatus.ContainsKey(senderId))
+ if (!runningStatus.TryGetValue(senderId, out byte value))
throw new InvalidDataException($"Received running status of sender {senderId}, but no event type was stored");
- eventType = runningStatus[senderId];
+ eventType = value;
key = statusType;
velocity = data[i++];
return;