From 57f1d3902bf1e64f4795a39816598754d57e3b7b Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 3 Jun 2024 02:18:57 +0200 Subject: [PATCH] Check for cancellation more often in generator --- .../CanvasEffectPropertyGenerator.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ComputeSharp.D2D1.WinUI.SourceGenerators/CanvasEffectPropertyGenerator.cs b/src/ComputeSharp.D2D1.WinUI.SourceGenerators/CanvasEffectPropertyGenerator.cs index d0d24d96..0430b410 100644 --- a/src/ComputeSharp.D2D1.WinUI.SourceGenerators/CanvasEffectPropertyGenerator.cs +++ b/src/ComputeSharp.D2D1.WinUI.SourceGenerators/CanvasEffectPropertyGenerator.cs @@ -39,10 +39,20 @@ public sealed partial class CanvasEffectPropertyGenerator : IIncrementalGenerato return default; } + token.ThrowIfCancellationRequested(); + string typeNameWithNullabilityAnnotations = propertySymbol.Type.GetFullyQualifiedNameWithNullabilityAnnotations(); + + token.ThrowIfCancellationRequested(); + bool isOldPropertyValueDirectlyReferenced = Execute.IsOldPropertyValueDirectlyReferenced(propertySymbol); + + token.ThrowIfCancellationRequested(); + CanvasEffectInvalidationType invalidationType = Execute.GetCanvasEffectInvalidationType(context.Attributes[0]); + token.ThrowIfCancellationRequested(); + // We're using IsValueType here and not IsReferenceType to also cover unconstrained type parameter cases. // This will cover both reference types as well T when the constraints are not struct or unmanaged. // If this is true, it means the field storage can potentially be in a null state (even if not annotated).