diff --git a/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs b/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs index 13c5e5ce3..7eac338b8 100644 --- a/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs +++ b/osu.Framework.Tests/Containers/ContainerEnumerableTest.cs @@ -46,7 +46,7 @@ namespace osu.Framework.Tests.Containers { var unused = new AudioContainer { - Children = (IReadOnlyList)Activator.CreateInstance(containerType) + Children = (IReadOnlyList)Activator.CreateInstance(containerType)! }; }); @@ -54,7 +54,7 @@ namespace osu.Framework.Tests.Containers { var unused = new AudioContainer(); - unused.AddRange((IEnumerable)Activator.CreateInstance(containerType)); + unused.AddRange((IEnumerable)Activator.CreateInstance(containerType)!); }); } } diff --git a/osu.Framework.Tests/Visual/Graphics/TestSceneStencil.cs b/osu.Framework.Tests/Visual/Graphics/TestSceneStencil.cs index cb2dfcdff..7d7dc20cf 100644 --- a/osu.Framework.Tests/Visual/Graphics/TestSceneStencil.cs +++ b/osu.Framework.Tests/Visual/Graphics/TestSceneStencil.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -94,6 +95,8 @@ namespace osu.Framework.Tests.Visual.Graphics // No depth testing. renderer.PushDepthInfo(new DepthInfo(false)); + Debug.Assert(Children != null); + drawStencil(renderer, Children[1]); drawBackground(renderer, Children[0]); @@ -141,7 +144,7 @@ namespace osu.Framework.Tests.Visual.Graphics renderer.PopStencilInfo(); } - public List Children { get; set; } = new List(); + public List? Children { get; set; } = new List(); public bool AddChildDrawNodes => true; } diff --git a/osu.Framework/Graphics/ICompositeDrawNode.cs b/osu.Framework/Graphics/ICompositeDrawNode.cs index 2987f468a..b61364850 100644 --- a/osu.Framework/Graphics/ICompositeDrawNode.cs +++ b/osu.Framework/Graphics/ICompositeDrawNode.cs @@ -15,7 +15,7 @@ namespace osu.Framework.Graphics /// /// The child s to draw. /// - List Children { get; set; } + List? Children { get; set; } /// /// Whether should be updated by the parenting . diff --git a/osu.Framework/Graphics/IDrawable.cs b/osu.Framework/Graphics/IDrawable.cs index 040308dd6..92fafe525 100644 --- a/osu.Framework/Graphics/IDrawable.cs +++ b/osu.Framework/Graphics/IDrawable.cs @@ -42,7 +42,7 @@ namespace osu.Framework.Graphics /// /// The parent of this drawable in the scene graph. /// - CompositeDrawable Parent { get; } + CompositeDrawable? Parent { get; } /// /// Whether this drawable is present for any sort of user-interaction.