Suppress some "necessary" warnings

This commit is contained in:
Matt Nadareski
2024-04-24 11:35:09 -04:00
parent 66e8eb985c
commit 469356e8c1
2 changed files with 4 additions and 3 deletions

View File

@@ -10,8 +10,9 @@
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
<!-- <TreatWarningsAsErrors>true</TreatWarningsAsErrors> --> <!-- Can't be enabled because of external code -->
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<Version>3.1.6</Version>
<WarningsNotAsErrors>CS0162;CS0612</WarningsNotAsErrors>
<!-- Package Properties -->
<Authors>Matt Nadareski</Authors>

View File

@@ -23,7 +23,7 @@ namespace System
public class Progress<T> : IProgress<T> where T : EventArgs
{
/// <summary>The synchronization context captured upon construction. This will never be null.</summary>
private readonly SynchronizationContext _synchronizationContext;
private readonly SynchronizationContext? _synchronizationContext;
/// <summary>The handler specified to the constructor. This may be null.</summary>
private readonly Action<T>? _handler;
/// <summary>A cached delegate used to post invocation to the synchronization context.</summary>
@@ -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);
}
}