From 5ad4a070b438c16345a3782e3ba9494b96fb5f11 Mon Sep 17 00:00:00 2001 From: Daniel Marbach Date: Mon, 16 Nov 2020 18:16:45 +0100 Subject: [PATCH] Make sure InputSizeTracker doesn't throw NullRef when projecting properties (#126) add a field null check --- .../Sink/InputSizeTracker.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/AzureTable/Microsoft.DataTransfer.AzureTable/Sink/InputSizeTracker.cs b/AzureTable/Microsoft.DataTransfer.AzureTable/Sink/InputSizeTracker.cs index e5d999a..bc3e884 100644 --- a/AzureTable/Microsoft.DataTransfer.AzureTable/Sink/InputSizeTracker.cs +++ b/AzureTable/Microsoft.DataTransfer.AzureTable/Sink/InputSizeTracker.cs @@ -63,6 +63,13 @@ namespace Microsoft.DataTransfer.TableAPI.Sink.Bulk foreach (var field in entity.Properties) { + // unfortunately it is not possible to access IsNull + if (field.Value.PropertyAsObject == null) + { + // projections can lead null fields being returned + continue; + } + length += field.Key.Length; switch (field.Value.PropertyType)