From f221445d7344da21c31457f49cd0f020ade7c8af Mon Sep 17 00:00:00 2001 From: Santiago Fernandez Madero Date: Mon, 15 Apr 2019 11:25:36 -0700 Subject: [PATCH] Fix build errors from merge conflicts and compiler update --- .../shared/System/DateTimeOffset.cs | 4 +- .../Runtime/CompilerServices/AsyncMethodBuilder.cs | 24 +++++----- .../Runtime/Serialization/SerializationInfo.cs | 56 +++++++++++----------- .../shared/System/Text/UTF8Encoding.cs | 28 +++++------ .../shared/System/TimeZoneInfo.AdjustmentRule.cs | 10 ++-- .../shared/System/TimeZoneInfo.TransitionTime.cs | 12 ++--- .../shared/System/TimeZoneInfo.Win32.cs | 4 +- .../shared/System/TimeZoneInfo.cs | 4 +- .../src/System/Reflection/Emit/ISymWrapperCore.cs | 4 +- 9 files changed, 73 insertions(+), 73 deletions(-) diff --git a/src/System.Private.CoreLib/shared/System/DateTimeOffset.cs b/src/System.Private.CoreLib/shared/System/DateTimeOffset.cs index 4052d55..8b0ea36 100644 --- a/src/System.Private.CoreLib/shared/System/DateTimeOffset.cs +++ b/src/System.Private.CoreLib/shared/System/DateTimeOffset.cs @@ -625,8 +625,8 @@ namespace System throw new ArgumentNullException(nameof(info)); } - _dateTime = (DateTime)info.GetValue("DateTime", typeof(DateTime)); // Do not rename (binary serialization) - _offsetMinutes = (short)info.GetValue("OffsetMinutes", typeof(short)); // Do not rename (binary serialization) + _dateTime = (DateTime)info.GetValue("DateTime", typeof(DateTime))!; // Do not rename (binary serialization) + _offsetMinutes = (short)info.GetValue("OffsetMinutes", typeof(short))!; // Do not rename (binary serialization) } // Returns the hash code for this DateTimeOffset. 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 fa0a79b..53978e8 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/CompilerServices/AsyncMethodBuilder.cs @@ -895,7 +895,7 @@ namespace System.Runtime.CompilerServices // For Boolean, we cache all possible values. if (typeof(TResult) == typeof(bool)) // only the relevant branches are kept for each value-type generic instantiation { - bool value = (bool)(object?)result; + bool value = (bool)(object)result!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 Task task = value ? AsyncTaskCache.TrueTask : AsyncTaskCache.FalseTask; return Unsafe.As>(task); // UnsafeCast avoids type check we know will succeed } @@ -905,7 +905,7 @@ namespace System.Runtime.CompilerServices // Compare to constants to avoid static field access if outside of cached range. // We compare to the upper bound first, as we're more likely to cache miss on the upper side than on the // lower side, due to positive values being more common than negative as return values. - int value = (int)(object?)result; + int value = (int)(object)result!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 if (value < AsyncTaskCache.EXCLUSIVE_INT32_MAX && value >= AsyncTaskCache.INCLUSIVE_INT32_MIN) { @@ -915,16 +915,16 @@ namespace System.Runtime.CompilerServices } // For other known value types, we only special-case 0 / default(TResult). else if ( - (typeof(TResult) == typeof(uint) && default == (uint)(object?)result) || - (typeof(TResult) == typeof(byte) && default(byte) == (byte)(object?)result) || - (typeof(TResult) == typeof(sbyte) && default(sbyte) == (sbyte)(object?)result) || - (typeof(TResult) == typeof(char) && default(char) == (char)(object?)result) || - (typeof(TResult) == typeof(long) && default == (long)(object?)result) || - (typeof(TResult) == typeof(ulong) && default == (ulong)(object?)result) || - (typeof(TResult) == typeof(short) && default(short) == (short)(object?)result) || - (typeof(TResult) == typeof(ushort) && default(ushort) == (ushort)(object?)result) || - (typeof(TResult) == typeof(IntPtr) && default == (IntPtr)(object?)result) || - (typeof(TResult) == typeof(UIntPtr) && default == (UIntPtr)(object?)result)) + (typeof(TResult) == typeof(uint) && default == (uint)(object)result!) || + (typeof(TResult) == typeof(byte) && default(byte) == (byte)(object)result!) || + (typeof(TResult) == typeof(sbyte) && default(sbyte) == (sbyte)(object)result!) || + (typeof(TResult) == typeof(char) && default(char) == (char)(object)result!) || + (typeof(TResult) == typeof(long) && default == (long)(object)result!) || + (typeof(TResult) == typeof(ulong) && default == (ulong)(object)result!) || + (typeof(TResult) == typeof(short) && default(short) == (short)(object)result!) || + (typeof(TResult) == typeof(ushort) && default(ushort) == (ushort)(object)result!) || + (typeof(TResult) == typeof(IntPtr) && default == (IntPtr)(object)result!) || + (typeof(TResult) == typeof(UIntPtr) && default == (UIntPtr)(object)result!)) // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 { return s_defaultResultTask; } diff --git a/src/System.Private.CoreLib/shared/System/Runtime/Serialization/SerializationInfo.cs b/src/System.Private.CoreLib/shared/System/Runtime/Serialization/SerializationInfo.cs index 2a4ab0e..e30e7d3 100644 --- a/src/System.Private.CoreLib/shared/System/Runtime/Serialization/SerializationInfo.cs +++ b/src/System.Private.CoreLib/shared/System/Runtime/Serialization/SerializationInfo.cs @@ -540,104 +540,104 @@ namespace System.Runtime.Serialization public bool GetBoolean(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(bool)) ? (bool)value : _converter.ToBoolean(value!); // if value is null To* method will either deal with it or throw + object value = GetElement(name, out foundType)!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 + return ReferenceEquals(foundType, typeof(bool)) ? (bool)value : _converter.ToBoolean(value); // if value is null To* method will either deal with it or throw } public char GetChar(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(char)) ? (char)value : _converter.ToChar(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(char)) ? (char)value : _converter.ToChar(value); } [CLSCompliant(false)] public sbyte GetSByte(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(sbyte)) ? (sbyte)value : _converter.ToSByte(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(sbyte)) ? (sbyte)value : _converter.ToSByte(value); } public byte GetByte(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(byte)) ? (byte)value : _converter.ToByte(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(byte)) ? (byte)value : _converter.ToByte(value); } public short GetInt16(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(short)) ? (short)value : _converter.ToInt16(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(short)) ? (short)value : _converter.ToInt16(value); } [CLSCompliant(false)] public ushort GetUInt16(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(ushort)) ? (ushort)value : _converter.ToUInt16(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(ushort)) ? (ushort)value : _converter.ToUInt16(value); } public int GetInt32(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(int)) ? (int)value : _converter.ToInt32(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(int)) ? (int)value : _converter.ToInt32(value); } [CLSCompliant(false)] public uint GetUInt32(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(uint)) ? (uint)value : _converter.ToUInt32(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(uint)) ? (uint)value : _converter.ToUInt32(value); } public long GetInt64(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(long)) ? (long)value : _converter.ToInt64(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(long)) ? (long)value : _converter.ToInt64(value); } [CLSCompliant(false)] public ulong GetUInt64(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(ulong)) ? (ulong)value : _converter.ToUInt64(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(ulong)) ? (ulong)value : _converter.ToUInt64(value); } public float GetSingle(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(float)) ? (float)value : _converter.ToSingle(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(float)) ? (float)value : _converter.ToSingle(value); } public double GetDouble(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(double)) ? (double)value : _converter.ToDouble(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(double)) ? (double)value : _converter.ToDouble(value); } public decimal GetDecimal(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(decimal)) ? (decimal)value : _converter.ToDecimal(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(decimal)) ? (decimal)value : _converter.ToDecimal(value); } public DateTime GetDateTime(string name) { Type foundType; - object? value = GetElement(name, out foundType); - return ReferenceEquals(foundType, typeof(DateTime)) ? (DateTime)value : _converter.ToDateTime(value!); + object value = GetElement(name, out foundType)!; + return ReferenceEquals(foundType, typeof(DateTime)) ? (DateTime)value : _converter.ToDateTime(value); } public string? GetString(string name) diff --git a/src/System.Private.CoreLib/shared/System/Text/UTF8Encoding.cs b/src/System.Private.CoreLib/shared/System/Text/UTF8Encoding.cs index f3e022c..688a431 100644 --- a/src/System.Private.CoreLib/shared/System/Text/UTF8Encoding.cs +++ b/src/System.Private.CoreLib/shared/System/Text/UTF8Encoding.cs @@ -2,7 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -#nullable enable // The worker functions in this file was optimized for performance. If you make changes // you should use care to consider all of the interesting cases. @@ -11,6 +10,7 @@ // The fast loops attempts to blaze through as fast as possible with optimistic range checks, // processing multiple characters at a time, and falling back to the slow loop for all special cases. +#nullable enable using System; using System.Buffers; using System.Diagnostics; @@ -139,7 +139,7 @@ namespace System.Text ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if (chars.Length - index < count) + if (chars!.Length - index < count) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer); } @@ -166,7 +166,7 @@ namespace System.Text fixed (char* pChars = chars) { - return GetByteCountCommon(pChars, chars.Length); + return GetByteCountCommon(pChars, chars!.Length); // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 } } @@ -233,7 +233,7 @@ namespace System.Text } [MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharCountCommon - private protected sealed override unsafe int GetByteCountFast(char* pChars, int charsLength, EncoderFallback fallback, out int charsConsumed) + private protected sealed override unsafe int GetByteCountFast(char* pChars, int charsLength, EncoderFallback? fallback, out int charsConsumed) { // The number of UTF-8 code units may exceed the number of UTF-16 code units, // so we'll need to check for overflow before casting to Int32. @@ -276,12 +276,12 @@ namespace System.Text resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if (s.Length - charIndex < charCount) + if (s!.Length - charIndex < charCount) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.s, ExceptionResource.ArgumentOutOfRange_IndexCount); } - if ((uint)byteIndex > bytes.Length) + if ((uint)byteIndex > bytes!.Length) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index); } @@ -326,12 +326,12 @@ namespace System.Text resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if (chars.Length - charIndex < charCount) + if (chars!.Length - charIndex < charCount) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.chars, ExceptionResource.ArgumentOutOfRange_IndexCount); } - if ((uint)byteIndex > bytes.Length) + if ((uint)byteIndex > bytes!.Length) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.byteIndex, ExceptionResource.ArgumentOutOfRange_Index); } @@ -444,7 +444,7 @@ namespace System.Text ThrowHelper.ThrowArgumentOutOfRangeException((index < 0) ? ExceptionArgument.index : ExceptionArgument.count, ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if (bytes.Length - index < count) + if (bytes!.Length - index < count) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer); } @@ -511,12 +511,12 @@ namespace System.Text resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if (bytes.Length - byteIndex < byteCount) + if (bytes!.Length - byteIndex < byteCount) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer); } - if ((uint)charIndex > (uint)chars.Length) + if ((uint)charIndex > (uint)chars!.Length) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.charIndex, ExceptionResource.ArgumentOutOfRange_Index); } @@ -614,7 +614,7 @@ namespace System.Text return (int)(pOutputBufferRemaining - pChars); } - private protected sealed override unsafe int GetCharsWithFallback(ReadOnlySpan bytes, int originalBytesLength, Span chars, int originalCharsLength, DecoderNLS decoder) + private protected sealed override unsafe int GetCharsWithFallback(ReadOnlySpan bytes, int originalBytesLength, Span chars, int originalCharsLength, DecoderNLS? decoder) { // We special-case DecoderReplacementFallback if it's telling us to write a single U+FFFD char, // since we believe this to be relatively common and we can handle it more efficiently than @@ -673,7 +673,7 @@ namespace System.Text resource: ExceptionResource.ArgumentOutOfRange_NeedNonNegNum); } - if (bytes.Length - index < count) + if (bytes!.Length - index < count) // TODO-NULLABLE: https://github.com/dotnet/csharplang/issues/538 { ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.bytes, ExceptionResource.ArgumentOutOfRange_IndexCountBuffer); } @@ -723,7 +723,7 @@ namespace System.Text } [MethodImpl(MethodImplOptions.AggressiveInlining)] // called directly by GetCharCountCommon - private protected sealed override unsafe int GetCharCountFast(byte* pBytes, int bytesLength, DecoderFallback fallback, out int bytesConsumed) + private protected sealed override unsafe int GetCharCountFast(byte* pBytes, int bytesLength, DecoderFallback? fallback, out int bytesConsumed) { // The number of UTF-16 code units will never exceed the number of UTF-8 code units, // so the addition at the end of this method will not overflow. diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.AdjustmentRule.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.AdjustmentRule.cs index 3a5c26f..7d046bd 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.AdjustmentRule.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.AdjustmentRule.cs @@ -249,11 +249,11 @@ namespace System throw new ArgumentNullException(nameof(info)); } - _dateStart = (DateTime)info.GetValue("DateStart", typeof(DateTime)); // Do not rename (binary serialization) - _dateEnd = (DateTime)info.GetValue("DateEnd", typeof(DateTime)); // Do not rename (binary serialization) - _daylightDelta = (TimeSpan)info.GetValue("DaylightDelta", typeof(TimeSpan)); // Do not rename (binary serialization) - _daylightTransitionStart = (TransitionTime)info.GetValue("DaylightTransitionStart", typeof(TransitionTime)); // Do not rename (binary serialization) - _daylightTransitionEnd = (TransitionTime)info.GetValue("DaylightTransitionEnd", typeof(TransitionTime)); // Do not rename (binary serialization) + _dateStart = (DateTime)info.GetValue("DateStart", typeof(DateTime))!; // Do not rename (binary serialization) + _dateEnd = (DateTime)info.GetValue("DateEnd", typeof(DateTime))!; // Do not rename (binary serialization) + _daylightDelta = (TimeSpan)info.GetValue("DaylightDelta", typeof(TimeSpan))!; // Do not rename (binary serialization) + _daylightTransitionStart = (TransitionTime)info.GetValue("DaylightTransitionStart", typeof(TransitionTime))!; // Do not rename (binary serialization) + _daylightTransitionEnd = (TransitionTime)info.GetValue("DaylightTransitionEnd", typeof(TransitionTime))!; // Do not rename (binary serialization) object? o = info.GetValueNoThrow("BaseUtcOffsetDelta", typeof(TimeSpan)); // Do not rename (binary serialization) if (o != null) diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.TransitionTime.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.TransitionTime.cs index 87c943d..86e7002 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.TransitionTime.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.TransitionTime.cs @@ -144,12 +144,12 @@ namespace System throw new ArgumentNullException(nameof(info)); } - _timeOfDay = (DateTime)info.GetValue("TimeOfDay", typeof(DateTime)); // Do not rename (binary serialization) - _month = (byte)info.GetValue("Month", typeof(byte)); // Do not rename (binary serialization) - _week = (byte)info.GetValue("Week", typeof(byte)); // Do not rename (binary serialization) - _day = (byte)info.GetValue("Day", typeof(byte)); // Do not rename (binary serialization) - _dayOfWeek = (DayOfWeek)info.GetValue("DayOfWeek", typeof(DayOfWeek)); // Do not rename (binary serialization) - _isFixedDateRule = (bool)info.GetValue("IsFixedDateRule", typeof(bool)); // Do not rename (binary serialization) + _timeOfDay = (DateTime)info.GetValue("TimeOfDay", typeof(DateTime))!; // Do not rename (binary serialization) + _month = (byte)info.GetValue("Month", typeof(byte))!; // Do not rename (binary serialization) + _week = (byte)info.GetValue("Week", typeof(byte))!; // Do not rename (binary serialization) + _day = (byte)info.GetValue("Day", typeof(byte))!; // Do not rename (binary serialization) + _dayOfWeek = (DayOfWeek)info.GetValue("DayOfWeek", typeof(DayOfWeek))!; // Do not rename (binary serialization) + _isFixedDateRule = (bool)info.GetValue("IsFixedDateRule", typeof(bool))!; // Do not rename (binary serialization) } } } diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs index d72ef1d..416b2c8 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.Win32.cs @@ -566,8 +566,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); - int last = (int)dynamicKey.GetValue(LastEntryValue, -1); + int first = (int)dynamicKey.GetValue(FirstEntryValue, -1)!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 + int last = (int)dynamicKey.GetValue(LastEntryValue, -1)!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 if (first == -1 || last == -1 || first > last) { diff --git a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.cs b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.cs index 617ee9a..2877598 100644 --- a/src/System.Private.CoreLib/shared/System/TimeZoneInfo.cs +++ b/src/System.Private.CoreLib/shared/System/TimeZoneInfo.cs @@ -1052,9 +1052,9 @@ namespace System _displayName = (string?)info.GetValue("DisplayName", typeof(string)); // Do not rename (binary serialization) _standardDisplayName = (string?)info.GetValue("StandardName", typeof(string)); // Do not rename (binary serialization) _daylightDisplayName = (string?)info.GetValue("DaylightName", typeof(string)); // Do not rename (binary serialization) - _baseUtcOffset = (TimeSpan)info.GetValue("BaseUtcOffset", typeof(TimeSpan)); // Do not rename (binary serialization) + _baseUtcOffset = (TimeSpan)info.GetValue("BaseUtcOffset", typeof(TimeSpan))!; // Do not rename (binary serialization) _adjustmentRules = (AdjustmentRule[]?)info.GetValue("AdjustmentRules", typeof(AdjustmentRule[])); // Do not rename (binary serialization) - _supportsDaylightSavingTime = (bool)info.GetValue("SupportsDaylightSavingTime", typeof(bool)); // Do not rename (binary serialization) + _supportsDaylightSavingTime = (bool)info.GetValue("SupportsDaylightSavingTime", typeof(bool))!; // Do not rename (binary serialization) } private AdjustmentRule? GetAdjustmentRuleForTime(DateTime dateTime, out int? ruleIndex) diff --git a/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs b/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs index 41ca677..69b283f 100644 --- a/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs +++ b/src/System.Private.CoreLib/src/System/Reflection/Emit/ISymWrapperCore.cs @@ -58,7 +58,7 @@ namespace System.Reflection.Emit m_pDocumentWriterSafeHandle = pDocumentWriterSafeHandle; // The handle is actually a pointer to a native ISymUnmanagedDocumentWriter. m_pDocWriter = (ISymUnmanagedDocumentWriter*)m_pDocumentWriterSafeHandle.DangerousGetHandle(); - m_vtable = (ISymUnmanagedDocumentWriterVTable)(Marshal.PtrToStructure(m_pDocWriter->m_unmanagedVTable, typeof(ISymUnmanagedDocumentWriterVTable))); + m_vtable = (ISymUnmanagedDocumentWriterVTable)(Marshal.PtrToStructure(m_pDocWriter->m_unmanagedVTable, typeof(ISymUnmanagedDocumentWriterVTable)))!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 } //------------------------------------------------------------------------------ @@ -359,7 +359,7 @@ namespace System.Reflection.Emit internal void InternalSetUnderlyingWriter(IntPtr ppUnderlyingWriter) { m_pWriter = *((ISymUnmanagedWriter**)ppUnderlyingWriter); - m_vtable = (ISymUnmanagedWriterVTable)(Marshal.PtrToStructure(m_pWriter->m_unmanagedVTable, typeof(ISymUnmanagedWriterVTable))); + m_vtable = (ISymUnmanagedWriterVTable)(Marshal.PtrToStructure(m_pWriter->m_unmanagedVTable, typeof(ISymUnmanagedWriterVTable)))!; // TODO-NULLABLE: https://github.com/dotnet/roslyn/issues/34976 } //------------------------------------------------------------------------------ -- 2.7.4