From fb8c77f96489cd7b20577016649ed018531374ea Mon Sep 17 00:00:00 2001 From: Stephen Toub Date: Fri, 12 Jan 2024 20:18:20 -0800 Subject: [PATCH] Comment out assert to workaround codegen bug (#96877) Co-authored-by: Jan Kotas --- .../src/System/Runtime/InteropServices/CollectionsMarshal.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs index e3cecd684abf6..ec3d0f08c8e1e 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Runtime/InteropServices/CollectionsMarshal.cs @@ -34,7 +34,8 @@ public static Span AsSpan(List? list) ThrowHelper.ThrowInvalidOperationException_ConcurrentOperationsNotSupported(); } - Debug.Assert(typeof(T[]) == list._items.GetType(), "Implementation depends on List always using a T[] and not U[] where U : T."); + // Commented out to workaround https://github.com/dotnet/runtime/issues/96876 + // Debug.Assert(typeof(T[]) == list._items.GetType(), "Implementation depends on List always using a T[] and not U[] where U : T."); span = new Span(ref MemoryMarshal.GetArrayDataReference(items), size); }