From 469356e8c1d498d7d1fa3b933351acea9d8db7f4 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 24 Apr 2024 11:35:09 -0400 Subject: [PATCH] Suppress some "necessary" warnings --- BinaryObjectScanner/BinaryObjectScanner.csproj | 3 ++- BinaryObjectScanner/Progress.cs | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/BinaryObjectScanner/BinaryObjectScanner.csproj b/BinaryObjectScanner/BinaryObjectScanner.csproj index 28ec8db3..847b3cf3 100644 --- a/BinaryObjectScanner/BinaryObjectScanner.csproj +++ b/BinaryObjectScanner/BinaryObjectScanner.csproj @@ -10,8 +10,9 @@ latest enable true - + true 3.1.6 + CS0162;CS0612 Matt Nadareski diff --git a/BinaryObjectScanner/Progress.cs b/BinaryObjectScanner/Progress.cs index 80811e68..dd1e8a1b 100644 --- a/BinaryObjectScanner/Progress.cs +++ b/BinaryObjectScanner/Progress.cs @@ -23,7 +23,7 @@ namespace System public class Progress : IProgress where T : EventArgs { /// The synchronization context captured upon construction. This will never be null. - private readonly SynchronizationContext _synchronizationContext; + private readonly SynchronizationContext? _synchronizationContext; /// The handler specified to the constructor. This may be null. private readonly Action? _handler; /// A cached delegate used to post invocation to the synchronization context. @@ -73,7 +73,7 @@ namespace System { // Post the processing to the sync context. // (If T is a value type, it will get boxed here.) - _synchronizationContext.Post(_invokeHandlers, value); + _synchronizationContext?.Post(_invokeHandlers, value); } }