Skip to content

Commit fe10fdf

Browse files
authored
Merge pull request #364 from winnerspiros/copilot/check-build-errors-and-warnings-again
Fix IL trimming warnings and iOS CI build failure
2 parents 8abf069 + b7292a8 commit fe10fdf

11 files changed

Lines changed: 23 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ jobs:
581581
dotnet-version: "10.0.x"
582582

583583
- name: Install .NET iOS workload
584-
run: dotnet workload install ios
584+
run: dotnet workload install ios --skip-manifest-update
585585

586586
- name: Authenticate to GitHub Packages
587587
run: dotnet nuget update source winnerspiros-github --username ${{ github.actor }} --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text

osu.Game.Tournament/Models/StableInfo.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.IO;
67
using Newtonsoft.Json;
78
using osu.Framework.Platform;
@@ -29,6 +30,7 @@ public class StableInfo
2930

3031
private readonly Storage configStorage;
3132

33+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Tournament uses Newtonsoft.Json which is not subject to IL trimming in this context.")]
3234
public StableInfo(TournamentStorage storage)
3335
{
3436
configStorage = storage.AllTournaments;
@@ -43,6 +45,7 @@ public StableInfo(TournamentStorage storage)
4345
}
4446
}
4547

48+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Tournament uses Newtonsoft.Json which is not subject to IL trimming in this context.")]
4649
public void SaveChanges()
4750
{
4851
using (var stream = configStorage.CreateFileSafely(config_path))

osu.Game.Tournament/TournamentGameBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.IO;
67
using System.Linq;
78
using System.Threading.Tasks;
@@ -97,6 +98,7 @@ protected override void LoadComplete()
9798
Task.Run(readBracket);
9899
}
99100

101+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Tournament uses Newtonsoft.Json which is not subject to IL trimming in this context.")]
100102
private async Task readBracket()
101103
{
102104
try
@@ -348,6 +350,7 @@ private void saveChanges()
348350
sw.Write(serialisedLadder);
349351
}
350352

353+
[UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "Tournament uses Newtonsoft.Json which is not subject to IL trimming in this context.")]
351354
public string GetSerialisedLadder()
352355
{
353356
foreach (var r in ladder.Rounds)

osu.Game/Overlays/WizardOverlay.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Diagnostics;
7+
using System.Diagnostics.CodeAnalysis;
78
using osu.Framework.Allocation;
89
using osu.Framework.Extensions;
910
using osu.Framework.Graphics;
@@ -200,6 +201,7 @@ private void showFirstStep()
200201
ShowNextStep();
201202
}
202203

204+
[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "Step types are always WizardScreen subtypes with parameterless constructors.")]
203205
protected virtual void ShowNextStep()
204206
{
205207
Debug.Assert(CurrentStepIndex != null);

osu.Game/Rulesets/Mods/IMod.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using osu.Framework.Bindables;
67
using osu.Framework.Graphics.Sprites;
78
using osu.Framework.Localisation;
@@ -82,6 +83,7 @@ public interface IMod : IEquatable<IMod>
8283
/// <summary>
8384
/// Create a fresh <see cref="Mod"/> instance based on this mod.
8485
/// </summary>
86+
[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "Concrete mod types always have parameterless constructors.")]
8587
Mod CreateInstance() => (Mod)Activator.CreateInstance(GetType())!;
8688

8789
/// <summary>

osu.Game/Rulesets/RealmRulesetStore.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System;
55
using System.Collections.Generic;
66
using System.Diagnostics;
7+
using System.Diagnostics.CodeAnalysis;
78
using System.IO;
89
using System.Linq;
910
using osu.Framework.Extensions.ObjectExtensions;
@@ -29,6 +30,7 @@ public RealmRulesetStore(RealmAccess realmAccess, Storage? storage = null)
2930
informUserAboutBrokenRulesets();
3031
}
3132

33+
[UnconditionalSuppressMessage("Trimming", "IL2057", Justification = "InstantiationInfo is a trusted ruleset type name from loaded assemblies.")]
3234
private void prepareDetachedRulesets()
3335
{
3436
realmAccess.Write(realm =>

osu.Game/Rulesets/RulesetInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System;
5+
using System.Diagnostics.CodeAnalysis;
56
using JetBrains.Annotations;
67
using osu.Game.Rulesets.Difficulty;
78
using Realms;
@@ -94,6 +95,7 @@ public override int GetHashCode()
9495
LastAppliedDifficultyVersion = LastAppliedDifficultyVersion,
9596
};
9697

98+
[UnconditionalSuppressMessage("Trimming", "IL2057", Justification = "InstantiationInfo is a trusted ruleset type name from loaded assemblies.")]
9799
public Ruleset CreateInstance()
98100
{
99101
if (!Available)

osu.Game/Screens/ScreenWhiteBox.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using System;
77
using System.Collections.Generic;
8+
using System.Diagnostics.CodeAnalysis;
89
using osu.Framework.Graphics;
910
using osu.Framework.Graphics.Containers;
1011
using osu.Framework.Graphics.Shapes;
@@ -52,6 +53,7 @@ public override void OnResuming(ScreenTransitionEvent e)
5253
this.FadeIn(transition_time, Easing.OutExpo);
5354
}
5455

56+
[UnconditionalSuppressMessage("Trimming", "IL2072", Justification = "PossibleChildren types always have parameterless constructors.")]
5557
public ScreenWhiteBox()
5658
{
5759
FillFlowContainer childModeButtons;

osu.Game/Screens/Select/ModSpeedHotkeyHandler.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// See the LICENCE file in the repository root for full licence text.
33

44
using System.Collections.Generic;
5+
using System.Diagnostics.CodeAnalysis;
56
using System.Linq;
67
using osu.Framework.Allocation;
78
using osu.Framework.Bindables;
@@ -45,6 +46,7 @@ private void storeLastActiveRateAdjustMod()
4546
lastActiveRateAdjustMod = (ModRateAdjust?)selectedMods.Value.OfType<ModRateAdjust>().SingleOrDefault()?.DeepClone() ?? lastActiveRateAdjustMod;
4647
}
4748

49+
[UnconditionalSuppressMessage("Trimming", "IL2075", Justification = "ModRateAdjust property names are stable and will not be trimmed.")]
4850
public bool ChangeSpeed(double delta, IEnumerable<Mod> availableMods)
4951
{
5052
double targetSpeed = (selectedMods.Value.OfType<ModRateAdjust>().SingleOrDefault()?.SpeedChange.Value ?? 1) + delta;

osu.Game/Skinning/SerialisedDrawableInfo.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
using System;
55
using System.Collections.Generic;
6+
using System.Diagnostics.CodeAnalysis;
67
using System.Linq;
78
using Newtonsoft.Json;
89
using osu.Framework.Bindables;
@@ -27,6 +28,7 @@ namespace osu.Game.Skinning
2728
[Serializable]
2829
public sealed class SerialisedDrawableInfo
2930
{
31+
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicParameterlessConstructor)]
3032
public Type Type { get; set; } = null!;
3133

3234
public Vector2 Position { get; set; }

0 commit comments

Comments
 (0)