diff options
author | Stephen Toub <stoub@microsoft.com> | 2019-07-11 13:05:51 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-11 13:05:51 -0400 |
commit | eff4feaa164ea7b6644fa7fb37f8238184de4cbc (patch) | |
tree | dd8b719b20d0277693ecd762d345ff89632995e6 /src | |
parent | 0d344b3df28dee8339ec3a77f26400e27e266de6 (diff) | |
download | coreclr-eff4feaa164ea7b6644fa7fb37f8238184de4cbc.tar.gz coreclr-eff4feaa164ea7b6644fa7fb37f8238184de4cbc.tar.bz2 coreclr-eff4feaa164ea7b6644fa7fb37f8238184de4cbc.zip |
Remove stale nullable !s and pragmas (#25640)
Also update TODO-NULLABLE comments to be more specific where appropriate.
Diffstat (limited to 'src')
29 files changed, 37 insertions, 45 deletions
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 de68a36cb9..b1589acff2 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 49e7485c00..82d62cc4d3 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 52dcd54c9e..7d5203d44f 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 e3f18fe6c0..65649e497d 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 2d8cd9c576..88856a599c 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<IPrincipal>)mi.CreateDelegate(typeof(Func<IPrincipal>))); } - 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<IPrincipal>)mi.CreateDelegate(typeof(Func<IPrincipal>))); } - 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 fcf0539df4..9c0501d054 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 181e2d258a..a10bb894a8 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 d62d03b193..bf4fbe1884 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 4a272244f7..5e13e3eb37 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 7fd16148e4..34939705e8 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 d536f5ccb4..3cad6fbf8c 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 28315b91db..8d117ebab1 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 48437f3620..60d2a1055a 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 274f163221..55b6d77f03 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 fd66c18912..35f9702327 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 /// <summary>A cached task for default(TResult).</summary> - internal readonly static Task<TResult> s_defaultResultTask = AsyncTaskCache.CreateCacheableTask(default(TResult)!); // TODO-NULLABLE: Remove ! when nullable attributes are respected + internal readonly static Task<TResult> s_defaultResultTask = AsyncTaskCache.CreateCacheableTask<TResult>(default); #endif /// <summary>The lazily-initialized built task.</summary> 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 4c346ffc29..a916d719fc 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<TKey, TValue>(key!, value); // TODO-NULLABLE: Remove ! when nullable attributes are respected + _current = new KeyValuePair<TKey, TValue>(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 cf279ac29c..e21e14e5a0 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 0ee21a2a70..4a80c4f361 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 } /// <summary> 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 1a7899d97c..bed2f81a91 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<TResult> : 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<TResult> s_Factory = new TaskFactory<TResult>(); 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 6464676b1b..904bf531a7 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<TResult>(true, default!, tco, ct); // TODO-NULLABLE: Remove ! when nullable attributes are respected + return new Task<TResult>(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 e72328ac54..a773749559 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 135f5883f3..6f25d4ccb9 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<TResult>(true, default!, TaskCreationOptions.None, cancellationToken); // TODO-NULLABLE: Remove ! when nullable attributes are respected + return new Task<TResult>(true, default, TaskCreationOptions.None, cancellationToken); } /// <summary>Creates a <see cref="Task"/> that's completed due to cancellation with the specified exception.</summary> @@ -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 cfb8040296..7ffb4bb8ec 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 1126ea3bf1..8e8506f39a 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; } /// <summary> diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Unix.cs index f5faca718d..b04ae348b7 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 e1cfe4e7ea..0ec94702df 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 b8a6dd83a7..996802013a 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 c2f1bf3ae5..8ceeb93b18 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<string, string>(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 c448b5b9b4..18988b7a20 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 } /// <summary> |