diff --git a/src/ComputeSharp.D2D1.NetStandard/ComputeSharp.D2D1.NetStandard.projitems b/src/ComputeSharp.D2D1.NetStandard/ComputeSharp.D2D1.NetStandard.projitems
index d973ffe7..4e744618 100644
--- a/src/ComputeSharp.D2D1.NetStandard/ComputeSharp.D2D1.NetStandard.projitems
+++ b/src/ComputeSharp.D2D1.NetStandard/ComputeSharp.D2D1.NetStandard.projitems
@@ -13,6 +13,7 @@
+
diff --git a/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/NotNullIfNotNullAttribute.cs b/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/NotNullIfNotNullAttribute.cs
new file mode 100644
index 00000000..4629b739
--- /dev/null
+++ b/src/ComputeSharp.D2D1.NetStandard/System/Diagnostics.CodeAnalysis/NotNullIfNotNullAttribute.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+
+namespace System.Diagnostics.CodeAnalysis;
+
+///
+/// Specifies that the output will be non-null if the named parameter is non-null.
+///
+[AttributeUsage(
+ AttributeTargets.Parameter |
+ AttributeTargets.Property |
+ AttributeTargets.ReturnValue,
+ AllowMultiple = true, Inherited = false)]
+internal sealed class NotNullIfNotNullAttribute : Attribute
+{
+ ///
+ /// Initializes the attribute with the associated parameter name.
+ ///
+ /// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
+ public NotNullIfNotNullAttribute(string parameterName)
+ {
+ ParameterName = parameterName;
+ }
+
+ ///
+ /// Gets the associated parameter name.
+ ///
+ public string ParameterName { get; }
+}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1.Uwp/CanvasEffect.cs b/src/ComputeSharp.D2D1.Uwp/CanvasEffect.cs
index 38accdbd..68f39a7f 100644
--- a/src/ComputeSharp.D2D1.Uwp/CanvasEffect.cs
+++ b/src/ComputeSharp.D2D1.Uwp/CanvasEffect.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Diagnostics.CodeAnalysis;
using ABI.Microsoft.Graphics.Canvas;
using Microsoft.Graphics.Canvas;
@@ -103,7 +104,7 @@ public abstract partial class CanvasEffect : ICanvasImage, ICanvasImageInterop.I
/// The storage for the effect property value.
/// The new effect property value to set.
/// The invalidation type to request.
- protected void SetAndInvalidateCanvasImage(/*[NotNullIfNotNull(nameof(newValue))]*/ ref T storage, T value, InvalidationType invalidationType = InvalidationType.Update)
+ protected void SetAndInvalidateCanvasImage([NotNullIfNotNull(nameof(value))] ref T storage, T value, InvalidationType invalidationType = InvalidationType.Update)
{
if (EqualityComparer.Default.Equals(storage, value))
{