From: Stephen Toub Date: Thu, 11 Jul 2019 17:05:51 +0000 (-0400) Subject: Remove stale nullable !s and pragmas (#25640) X-Git-Tag: accepted/tizen/unified/20191011.080124~150^2~32 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=eff4feaa164ea7b6644fa7fb37f8238184de4cbc;p=platform%2Fupstream%2Fcoreclr.git Remove stale nullable !s and pragmas (#25640) Also update TODO-NULLABLE comments to be more specific where appropriate. --- diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs index de68a36..b1589ac 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile.cs @@ -33,7 +33,7 @@ internal partial class Interop int dwFlagsAndAttributes, IntPtr hTemplateFile) { - lpFileName = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + lpFileName = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected return CreateFilePrivate(lpFileName, dwDesiredAccess, dwShareMode, ref securityAttrs, dwCreationDisposition, dwFlagsAndAttributes, hTemplateFile); } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs index 49e7485..82d62cc 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.CreateFile2.cs @@ -26,7 +26,7 @@ internal partial class Interop FileMode dwCreationDisposition, ref Kernel32.CREATEFILE2_EXTENDED_PARAMETERS pCreateExParams) { - lpFileName = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + lpFileName = PathInternal.EnsureExtendedPrefixIfNeeded(lpFileName)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected return CreateFile2Private(lpFileName, dwDesiredAccess, dwShareMode, dwCreationDisposition, ref pCreateExParams); } } diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs index 52dcd54..7d5203d 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.FindFirstFileEx.cs @@ -21,7 +21,7 @@ internal partial class Interop internal static SafeFindHandle FindFirstFile(string fileName, ref WIN32_FIND_DATA data) { - fileName = PathInternal.EnsureExtendedPrefixIfNeeded(fileName)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + fileName = PathInternal.EnsureExtendedPrefixIfNeeded(fileName)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected // use FindExInfoBasic since we don't care about short name and it has better perf return FindFirstFileExPrivate(fileName, FINDEX_INFO_LEVELS.FindExInfoBasic, ref data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, 0); diff --git a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs index e3f18fe..65649e4 100644 --- a/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs +++ b/src/System.Private.CoreLib/shared/Interop/Windows/Kernel32/Interop.GetFileAttributesEx.cs @@ -21,7 +21,7 @@ internal partial class Interop internal static bool GetFileAttributesEx(string name, GET_FILEEX_INFO_LEVELS fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation) { - name = PathInternal.EnsureExtendedPrefixIfNeeded(name)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + name = PathInternal.EnsureExtendedPrefixIfNeeded(name)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected return GetFileAttributesExPrivate(name, fileInfoLevel, ref lpFileInformation); } } diff --git a/src/System.Private.CoreLib/shared/System/AppDomain.cs b/src/System.Private.CoreLib/shared/System/AppDomain.cs index 2d8cd9c..88856a5 100644 --- a/src/System.Private.CoreLib/shared/System/AppDomain.cs +++ b/src/System.Private.CoreLib/shared/System/AppDomain.cs @@ -409,7 +409,7 @@ namespace System (Func)mi.CreateDelegate(typeof(Func))); } - principal = s_getUnauthenticatedPrincipal!(); // TODO-NULLABLE: Remove ! when nullable attributes are respected + principal = s_getUnauthenticatedPrincipal!(); // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected break; case PrincipalPolicy.WindowsPrincipal: @@ -425,7 +425,7 @@ namespace System (Func)mi.CreateDelegate(typeof(Func))); } - principal = s_getWindowsPrincipal!(); // TODO-NULLABLE: Remove ! when nullable attributes are respected + principal = s_getWindowsPrincipal!(); // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected break; } } diff --git a/src/System.Private.CoreLib/shared/System/Collections/Concurrent/ConcurrentQueueSegment.cs b/src/System.Private.CoreLib/shared/System/Collections/Concurrent/ConcurrentQueueSegment.cs index fcf0539..9c0501d 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/Concurrent/ConcurrentQueueSegment.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/Concurrent/ConcurrentQueueSegment.cs @@ -166,7 +166,7 @@ namespace System.Collections.Concurrent // If we're preserving, though, we don't zero out the slot, as we need it for // enumerations, peeking, ToArray, etc. And we don't update the sequence number, // so that an enqueuer will see it as full and be forced to move to a new segment. - slots[slotsIndex].Item = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + slots[slotsIndex].Item = default; Volatile.Write(ref slots[slotsIndex].SequenceNumber, currentHead + slots.Length); } return true; diff --git a/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs b/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs index 181e2d2..a10bb89 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/Generic/Dictionary.cs @@ -1411,7 +1411,7 @@ namespace System.Collections.Generic _dictionary = dictionary; _version = dictionary._version; _index = 0; - _currentKey = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _currentKey = default; } public void Dispose() @@ -1437,7 +1437,7 @@ namespace System.Collections.Generic } _index = _dictionary._count + 1; - _currentKey = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _currentKey = default; return false; } @@ -1464,7 +1464,7 @@ namespace System.Collections.Generic } _index = 0; - _currentKey = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _currentKey = default; } } } @@ -1594,7 +1594,7 @@ namespace System.Collections.Generic _dictionary = dictionary; _version = dictionary._version; _index = 0; - _currentValue = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _currentValue = default; } public void Dispose() @@ -1619,7 +1619,7 @@ namespace System.Collections.Generic } } _index = _dictionary._count + 1; - _currentValue = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _currentValue = default; return false; } @@ -1645,7 +1645,7 @@ namespace System.Collections.Generic ThrowHelper.ThrowInvalidOperationException_InvalidOperation_EnumFailedVersion(); } _index = 0; - _currentValue = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _currentValue = default; } } } diff --git a/src/System.Private.CoreLib/shared/System/Collections/Generic/EqualityComparer.cs b/src/System.Private.CoreLib/shared/System/Collections/Generic/EqualityComparer.cs index d62d03b..bf4fbe1 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/Generic/EqualityComparer.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/Generic/EqualityComparer.cs @@ -17,9 +17,7 @@ namespace System.Collections.Generic public abstract bool Equals([AllowNull] T x, [AllowNull] T y); public abstract int GetHashCode([DisallowNull] T obj); -#pragma warning disable CS8617 // TODO-NULLABLE: Covariance in interfaces (https://github.com/dotnet/roslyn/issues/35227) int IEqualityComparer.GetHashCode(object? obj) -#pragma warning restore CS8617 { if (obj == null) return 0; if (obj is T) return GetHashCode((T)obj); diff --git a/src/System.Private.CoreLib/shared/System/Collections/Generic/List.cs b/src/System.Private.CoreLib/shared/System/Collections/Generic/List.cs index 4a27224..5e13e3e 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/Generic/List.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/Generic/List.cs @@ -1092,7 +1092,7 @@ namespace System.Collections.Generic _list = list; _index = 0; _version = list._version; - _current = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _current = default; } public void Dispose() @@ -1120,7 +1120,7 @@ namespace System.Collections.Generic } _index = _list._size + 1; - _current = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _current = default; return false; } @@ -1146,7 +1146,7 @@ namespace System.Collections.Generic } _index = 0; - _current = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _current = default; } } } diff --git a/src/System.Private.CoreLib/shared/System/Collections/ListDictionaryInternal.cs b/src/System.Private.CoreLib/shared/System/Collections/ListDictionaryInternal.cs index 7fd1614..3493970 100644 --- a/src/System.Private.CoreLib/shared/System/Collections/ListDictionaryInternal.cs +++ b/src/System.Private.CoreLib/shared/System/Collections/ListDictionaryInternal.cs @@ -283,9 +283,7 @@ namespace System.Collections current = null; } -#pragma warning disable CS8612 // TODO-NULLABLE: Covariance in interfaces (https://github.com/dotnet/roslyn/issues/35227) public object Current -#pragma warning restore CS8612 { get { diff --git a/src/System.Private.CoreLib/shared/System/Environment.Win32.cs b/src/System.Private.CoreLib/shared/System/Environment.Win32.cs index d536f5c..3cad6fb 100644 --- a/src/System.Private.CoreLib/shared/System/Environment.Win32.cs +++ b/src/System.Private.CoreLib/shared/System/Environment.Win32.cs @@ -80,7 +80,7 @@ namespace System { foreach (string name in environmentKey.GetValueNames()) { - string? value = environmentKey.GetValue(name, "")!.ToString(); // TODO-NULLABLE: Remove ! when nullable attributes are respected + string? value = environmentKey.GetValue(name, "")!.ToString(); // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected try { results.Add(name, value); diff --git a/src/System.Private.CoreLib/shared/System/Globalization/CultureData.Windows.cs b/src/System.Private.CoreLib/shared/System/Globalization/CultureData.Windows.cs index 28315b9..8d117eb 100644 --- a/src/System.Private.CoreLib/shared/System/Globalization/CultureData.Windows.cs +++ b/src/System.Private.CoreLib/shared/System/Globalization/CultureData.Windows.cs @@ -432,7 +432,7 @@ namespace System.Globalization { for (int i = 0; i < array.Length; i++) { - array[i] = ReescapeWin32String(array[i])!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + array[i] = ReescapeWin32String(array[i])!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected } } diff --git a/src/System.Private.CoreLib/shared/System/Globalization/TextElementEnumerator.cs b/src/System.Private.CoreLib/shared/System/Globalization/TextElementEnumerator.cs index 48437f3..60d2a10 100644 --- a/src/System.Private.CoreLib/shared/System/Globalization/TextElementEnumerator.cs +++ b/src/System.Private.CoreLib/shared/System/Globalization/TextElementEnumerator.cs @@ -50,9 +50,7 @@ namespace System.Globalization return true; } -#pragma warning disable CS8612 // TODO-NULLABLE: Covariance in interfaces (https://github.com/dotnet/roslyn/issues/35227) public object Current => GetTextElement(); -#pragma warning restore CS8612 public string GetTextElement() { diff --git a/src/System.Private.CoreLib/shared/System/Resources/ResourceReader.cs b/src/System.Private.CoreLib/shared/System/Resources/ResourceReader.cs index 274f163..55b6d77 100644 --- a/src/System.Private.CoreLib/shared/System/Resources/ResourceReader.cs +++ b/src/System.Private.CoreLib/shared/System/Resources/ResourceReader.cs @@ -1030,9 +1030,7 @@ namespace System.Resources } } -#pragma warning disable CS8612 // TODO-NULLABLE: Covariance in interfaces (https://github.com/dotnet/roslyn/issues/35227) public object Current => Entry; -#pragma warning restore CS8612 // Warning: This requires that you call the Key or Entry property FIRST before calling it! internal int DataPosition => _dataPosition; diff --git a/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs b/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs index fd66c18..35f9702 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs @@ -315,7 +315,7 @@ namespace System.Runtime.CompilerServices { #if !PROJECTN /// A cached task for default(TResult). - internal readonly static Task s_defaultResultTask = AsyncTaskCache.CreateCacheableTask(default(TResult)!); // TODO-NULLABLE: Remove ! when nullable attributes are respected + internal readonly static Task s_defaultResultTask = AsyncTaskCache.CreateCacheableTask(default); #endif /// The lazily-initialized built task. diff --git a/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/ConditionalWeakTable.cs b/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/ConditionalWeakTable.cs index 4c346ff..a916d71 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/ConditionalWeakTable.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/ConditionalWeakTable.cs @@ -339,7 +339,7 @@ namespace System.Runtime.CompilerServices _currentIndex++; if (c.TryGetEntry(_currentIndex, out TKey? key, out TValue value)) { - _current = new KeyValuePair(key!, value); // TODO-NULLABLE: Remove ! when nullable attributes are respected + _current = new KeyValuePair(key, value); return true; } } diff --git a/src/System.Private.CoreLib/shared/System/Threading/AsyncLocal.cs b/src/System.Private.CoreLib/shared/System/Threading/AsyncLocal.cs index cf279ac..e21e14e 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/AsyncLocal.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/AsyncLocal.cs @@ -63,7 +63,7 @@ namespace System.Threading get { object? obj = ExecutionContext.GetLocalValue(this); - return (obj == null) ? default! : (T)obj; // TODO-NULLABLE: Remove ! when nullable attributes are respected + return (obj == null) ? default : (T)obj; } set { diff --git a/src/System.Private.CoreLib/shared/System/Threading/LazyInitializer.cs b/src/System.Private.CoreLib/shared/System/Threading/LazyInitializer.cs index 0ee21a2..4a80c4f 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/LazyInitializer.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/LazyInitializer.cs @@ -272,7 +272,7 @@ namespace System.Threading } } - return target!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + return target!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected } /// diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Future.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Future.cs index 1a7899d..bed2f81 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Future.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Future.cs @@ -62,7 +62,7 @@ namespace System.Threading.Tasks public class Task : Task { // The value itself, if set. - [MaybeNull] internal TResult m_result = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + [MaybeNull] internal TResult m_result = default!; private static readonly TaskFactory s_Factory = new TaskFactory(); diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs index 6464676..904bf53 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/FutureFactory.cs @@ -1324,7 +1324,7 @@ namespace System.Threading.Tasks { TaskCreationOptions tco; Task.CreationOptionsFromContinuationOptions(continuationOptions, out tco, out _); - return new Task(true, default!, tco, ct); // TODO-NULLABLE: Remove ! when nullable attributes are respected + return new Task(true, default, tco, ct); } // diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs index e72328a..a773749 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Sources/ManualResetValueTaskSourceCore.cs @@ -48,7 +48,7 @@ namespace System.Threading.Tasks.Sources // Reset/update state for the next use/await of this instance. _version++; _completed = false; - _result = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _result = default; _error = null; _executionContext = null; _capturedContext = null; diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs index 135f588..6f25d4c 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/Task.cs @@ -5208,7 +5208,7 @@ namespace System.Threading.Tasks { if (!cancellationToken.IsCancellationRequested) ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.cancellationToken); - return new Task(true, default!, TaskCreationOptions.None, cancellationToken); // TODO-NULLABLE: Remove ! when nullable attributes are respected + return new Task(true, default, TaskCreationOptions.None, cancellationToken); } /// Creates a that's completed due to cancellation with the specified exception. @@ -6694,7 +6694,7 @@ namespace System.Threading.Tasks if (Task.s_asyncDebuggingEnabled) RemoveFromActiveTasks(this); - result = TrySetResult(taskTResult != null ? taskTResult.Result : default!); // TODO-NULLABLE: Remove ! when nullable attributes are respected + result = TrySetResult(taskTResult != null ? taskTResult.Result : default); break; } return result; diff --git a/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs b/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs index cfb8040..7ffb4bb 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/Tasks/ValueTask.cs @@ -449,7 +449,7 @@ namespace System.Threading.Tasks _obj = task; - _result = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _result = default; _continueOnCapturedContext = true; _token = 0; } @@ -468,7 +468,7 @@ namespace System.Threading.Tasks _obj = source; _token = token; - _result = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + _result = default; _continueOnCapturedContext = true; } diff --git a/src/System.Private.CoreLib/shared/System/Threading/ThreadLocal.cs b/src/System.Private.CoreLib/shared/System/Threading/ThreadLocal.cs index 1126ea3..8e8506f 100644 --- a/src/System.Private.CoreLib/shared/System/Threading/ThreadLocal.cs +++ b/src/System.Private.CoreLib/shared/System/Threading/ThreadLocal.cs @@ -202,7 +202,7 @@ namespace System.Threading // And clear the references from the slot table to the linked slot and the value so that // both can get garbage collected. - slotArray[id].Value!._value = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + slotArray[id].Value!._value = default; slotArray[id].Value = null; } } @@ -675,7 +675,7 @@ namespace System.Threading internal volatile LinkedSlotVolatile[]? _slotArray; // The value for this slot. - [AllowNull, MaybeNull] internal T _value = default!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + [AllowNull, MaybeNull] internal T _value = default; } /// diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs index f5faca7..b04ae34 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs @@ -396,7 +396,7 @@ namespace System if (symlinkPath != null) { // symlinkPath can be relative path, use Path to get the full absolute path. - symlinkPath = Path.GetFullPath(symlinkPath, Path.GetDirectoryName(tzFilePath)!); // TODO-NULLABLE: Remove ! when nullable attributes are respected + symlinkPath = Path.GetFullPath(symlinkPath, Path.GetDirectoryName(tzFilePath)!); string timeZoneDirectory = GetTimeZoneDirectory(); if (symlinkPath.StartsWith(timeZoneDirectory, StringComparison.Ordinal)) diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs index e1cfe4e..0ec9470 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs @@ -563,8 +563,8 @@ namespace System // read LastEntry {(yearN, 1, 1) - MaxValue } // read the FirstEntry and LastEntry key values (ex: "1980", "2038") - int first = (int)dynamicKey.GetValue(FirstEntryValue, -1)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected - int last = (int)dynamicKey.GetValue(LastEntryValue, -1)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + int first = (int)dynamicKey.GetValue(FirstEntryValue, -1)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected + int last = (int)dynamicKey.GetValue(LastEntryValue, -1)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected if (first == -1 || last == -1 || first > last) { diff --git a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComEventsMethod.cs b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComEventsMethod.cs index b8a6dd8..9968020 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComEventsMethod.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/InteropServices/ComEventsMethod.cs @@ -173,7 +173,7 @@ namespace System.Runtime.InteropServices { if (wrapper.Delegate.GetType() == d.GetType()) { - wrapper.Delegate = Delegate.Combine(wrapper.Delegate, d)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + wrapper.Delegate = Delegate.Combine(wrapper.Delegate, d)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected return; } } diff --git a/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs b/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs index c2f1bf3..8ceeb93 100644 --- a/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs +++ b/src/System.Private.CoreLib/src/System/Runtime/Loader/AssemblyDependencyResolver.cs @@ -99,7 +99,7 @@ namespace System.Runtime.Loader _assemblyPaths = new Dictionary(StringComparer.OrdinalIgnoreCase); foreach (string assemblyPath in assemblyPaths) { - _assemblyPaths.Add(Path.GetFileNameWithoutExtension(assemblyPath)!, assemblyPath); // TODO-NULLABLE: Remove ! when nullable attributes are respected + _assemblyPaths.Add(Path.GetFileNameWithoutExtension(assemblyPath)!, assemblyPath); // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected } _nativeSearchPaths = SplitPathsList(nativeSearchPathsList); diff --git a/src/System.Private.CoreLib/src/System/Utf8String.Construction.cs b/src/System.Private.CoreLib/src/System/Utf8String.Construction.cs index c448b5b..18988b7 100644 --- a/src/System.Private.CoreLib/src/System/Utf8String.Construction.cs +++ b/src/System.Private.CoreLib/src/System/Utf8String.Construction.cs @@ -49,7 +49,7 @@ namespace System Utf8String newString = FastAllocate(value.Length); Buffer.Memmove(ref newString.DangerousGetMutableReference(), ref MemoryMarshal.GetReference(value), (uint)value.Length); - return Utf8Utility.ValidateAndFixupUtf8String(newString)!; // TODO-NULLABLE: Remove ! when nullable attributes are respected + return Utf8Utility.ValidateAndFixupUtf8String(newString)!; // TODO-NULLABLE: Remove ! when [NotNullIfNotNull] respected } ///