guix_mirror_bot pushed a commit to branch master
in repository guix.
commit d71affea0c59266b8fc75377c3e6d32878a29b56
Author: Danny Milosavljevic <[email protected]>
AuthorDate: Wed Apr 8 17:06:24 2026 +0200
gnu: Add [email protected].
* gnu/packages/patches/roslyn-3.0.0-bootstrap-with-csc-2.8.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add reference to it.
* gnu/packages/dotnet.scm (roslyn-3.0): New variable.
Change-Id: I385b29abff8c0b4672125786b948aafdd69cb014
---
gnu/local.mk | 1 +
gnu/packages/dotnet.scm | 174 +++++++++++
.../roslyn-3.0.0-bootstrap-with-csc-2.8.patch | 321 +++++++++++++++++++++
3 files changed, 496 insertions(+)
diff --git a/gnu/local.mk b/gnu/local.mk
index aca3d6cbef..0046d700f4 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -2427,6 +2427,7 @@ dist_patch_DATA =
\
%D%/packages/patches/roslyn-2.0.0-bootstrap-with-mono.patch \
%D%/packages/patches/roslyn-2.3.0-default-literal-for-csc-2.0.patch \
%D%/packages/patches/roslyn-2.8.2-csharp-7.2-for-csc-2.3.patch \
+ %D%/packages/patches/roslyn-3.0.0-bootstrap-with-csc-2.8.patch \
%D%/packages/patches/rottlog-direntry.patch \
%D%/packages/patches/ruby-actionpack-remove-browser-tests.patch \
%D%/packages/patches/ruby-activesupport-fix-deprecation-warning.patch
\
diff --git a/gnu/packages/dotnet.scm b/gnu/packages/dotnet.scm
index 2564dc2f33..b914d29fe6 100644
--- a/gnu/packages/dotnet.scm
+++ b/gnu/packages/dotnet.scm
@@ -2783,6 +2783,180 @@ namespace Microsoft.DiaSymReader
"This package provides the Roslyn C# compiler (@command{csc}), built
from source using @code{roslyn-2.3} as the bootstrap compiler. It produces
a C# 7.2 compiler.")))
+
+;;;
+;;; roslyn-3.0: inherits roslyn-2.8, built with csc 2.8
+;;;
+
+(define-public roslyn-3.0
+ (package
+ (inherit roslyn-2.8)
+ (version "3.0.0")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/dotnet/roslyn")
+ (commit (string-append "version-" version))))
+ (file-name (git-file-name "roslyn" version))
+ (sha256
+ (base32
+ "17x9bapqaaapa7jsb2sz9pm20swgj40naxlgci4nc9xh7brahcqw"))
+ (patches
+ (search-patches "roslyn-3.0.0-bootstrap-with-csc-2.8.patch"))))
+ (native-inputs (list roslyn-2.8))
+ (arguments
+ (substitute-keyword-arguments (package-arguments roslyn-2.8)
+ ((#:phases phases '())
+ #~(modify-phases #$phases
+ ;; No compiler-compat or mono-compat fixes needed for 3.0;
+ ;; the patch handles ReadOnlySpan and other changes.
+ ;; KeyValuePair helper was removed in 3.0.
+ (replace 'fix-compiler-compat
+ (lambda _ #t))
+ (replace 'fix-mono-compat
+ (lambda _
+ ;; Only CodePagesEncodingProvider remains.
+ (substitute* "src/Compilers/Core/Portable/EncodedStringText.cs"
+ (("if \\(CodePagesEncodingProvider\\.Instance != null\\)")
+ "if (false)")
+
(("Encoding\\.RegisterProvider\\(CodePagesEncodingProvider\\.Instance\\);")
+ "// not available in Mono"))))
+
+ ;; 3.0 has more files with PathUtilities ambiguity.
+ (add-after 'fix-srm-inline 'fix-srm-inline-3.0
+ (lambda _
+ (substitute* (list
+
"src/Compilers/Core/Portable/StrongName/DesktopStrongNameProvider.cs"
+
"src/Compilers/Core/Portable/DiagnosticAnalyzer/AnalyzerFileReference.cs")
+ (("\\bPathUtilities\\.")
+ "Roslyn.Utilities.PathUtilities."))))
+
+ ;; 3.0 has no stale files from 2.x. Only DiaSymReader COM
+ ;; files need stubbing (inherited from create-diasymreader-stubs).
+ ;; Rename file with trailing space in its name.
+ (replace 'remove-stale-files
+ (lambda _
+ (rename-file
+
"src/Compilers/Core/Portable/Operations/IConstructorBodyOperation .cs"
+
"src/Compilers/Core/Portable/Operations/IConstructorBodyOperation.cs")
+ (for-each
+ (lambda (f) (when (file-exists? f) (delete-file f)))
+
'("src/Compilers/Core/Portable/DiaSymReader/Utilities/IUnsafeComStream.cs"
+
"src/Compilers/Core/Portable/DiaSymReader/Utilities/ComMemoryStream.cs"))))
+
+ ;; csc.rsp: C# 7.3 langversion, NET472 define (was NET46 in 2.8).
+ (replace 'create-csc-rsp
+ (lambda _
+ (call-with-output-file "csc.rsp"
+ (lambda (port)
+ (display "-langversion:7.3\n-d:NET472\n" port)))))
+
+ ;; Point at roslyn-2.8's csc.
+ (replace 'create-csc-wrapper
+ (lambda* (#:key inputs #:allow-other-keys)
+ (mkdir-p "bootstrap-bin")
+ (call-with-output-file "bootstrap-bin/csc"
+ (lambda (port)
+ (format port "#!~a~%exec mono ~a \"$@\"~%"
+ (which "bash")
+ (string-append (assoc-ref inputs "roslyn")
"/lib/roslyn/csc.exe"))))
+ (chmod "bootstrap-bin/csc" #o755)
+ (setenv "PATH"
+ (string-append (getcwd) "/bootstrap-bin:"
+ (getenv "PATH")))))
+
+ ;; 3.0 csc.exe needs additional shared files.
+ (replace 'compile
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((sci-dll
+ (search-input-file
+ inputs
"/lib/mono/4.5/System.Collections.Immutable.dll"))
+ (srm-dir
+ (if (file-exists? "srm-src-patched")
+ "srm-src-patched"
+ #$%srm-source-dir))
+ (srm-source-files
+ (filter
+ (lambda (f)
+ (not (or (string-contains f "netstandard")
+ (string-contains f "netcoreapp")
+ (string-contains f "AssemblyInfo")
+ (string-suffix? "/SR.cs" f))))
+ (find-files srm-dir "\\.cs$")))
+ (deps-dir
+ (if (file-exists?
"src/Dependencies/CodeAnalysis.Metadata")
+ "src/Dependencies/CodeAnalysis.Metadata"
+ "src/Dependencies/CodeAnalysis.Debugging")))
+
+ ;; 1. Microsoft.CodeAnalysis.dll
+ (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
+ "-out:Microsoft.CodeAnalysis.dll"
+ (string-append
+
"-resource:Microsoft.CodeAnalysis.CodeAnalysisResources.resources"
+
",Microsoft.CodeAnalysis.CodeAnalysisResources.resources")
+ "-r:System.dll" "-r:System.Core.dll"
+ "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
+ "-r:System.Numerics.dll"
"-r:System.IO.Compression.dll"
+ "-r:System.Security.dll"
+ "-r:System.Runtime.Serialization.dll"
+ (string-append "-r:" sci-dll)
+ "-d:COMPILERCORE" "-d:SRM"
+ "bootstrap-sr.cs" "bootstrap-ivt.cs"
+ "src/Compilers/Shared/CoreClrShim.cs"
+ "src/Compilers/Shared/DesktopShim.cs"
+ (append
+ (find-files "src/Compilers/Core/Portable" "\\.cs$")
+ (find-files "src/Compilers/Core/AnalyzerDriver"
"\\.cs$")
+ (find-files deps-dir "\\.cs$")
+ (find-files "src/Dependencies/PooledObjects"
"\\.cs$")
+ srm-source-files))
+
+ ;; 2. Microsoft.CodeAnalysis.CSharp.dll
+ (apply invoke "csc" "@csc.rsp" "-target:library" "-unsafe"
+ "-out:Microsoft.CodeAnalysis.CSharp.dll"
+ (string-append
+
"-resource:Microsoft.CodeAnalysis.CSharp.CSharpResources.resources"
+
",Microsoft.CodeAnalysis.CSharp.CSharpResources.resources")
+ "-r:System.dll" "-r:System.Core.dll"
+ "-r:System.Xml.dll" "-r:System.Xml.Linq.dll"
+ "-r:System.Numerics.dll"
"-r:System.IO.Compression.dll"
+ (string-append "-r:" sci-dll)
+ "-r:Microsoft.CodeAnalysis.dll"
+ "bootstrap-csharp-ivt.cs"
+
"src/Compilers/CSharp/CSharpAnalyzerDriver/CSharpDeclarationComputer.cs"
+ (append
+ (find-files "src/Compilers/CSharp/Portable" "\\.cs$")
+ (if (file-exists? "generated")
+ (find-files "generated" "\\.cs$")
+ '())))
+
+ ;; 3. csc.exe - 3.0 added RuntimeHostInfo and NamedPipeUtil.
+ (invoke "csc" "@csc.rsp" "-out:csc.exe"
+ "-r:System.dll" "-r:System.Core.dll"
+ (string-append "-r:" sci-dll)
+ "-r:Microsoft.CodeAnalysis.dll"
+ "-r:Microsoft.CodeAnalysis.CSharp.dll"
+ "src/Compilers/CSharp/csc/Program.cs"
+ "src/Compilers/Shared/Csc.cs"
+ "src/Compilers/Shared/BuildClient.cs"
+ "src/Compilers/Shared/BuildServerConnection.cs"
+ "src/Compilers/Shared/DesktopBuildClient.cs"
+
"src/Compilers/Shared/DesktopAnalyzerAssemblyLoader.cs"
+ "src/Compilers/Shared/ExitingTraceListener.cs"
+ "src/Compilers/Shared/CoreClrShim.cs"
+ "src/Compilers/Shared/DesktopShim.cs"
+ "src/Compilers/Shared/RuntimeHostInfo.cs"
+ "src/Compilers/Shared/NamedPipeUtil.cs"
+ "src/Compilers/Core/CommandLine/BuildProtocol.cs"
+ "src/Compilers/Core/CommandLine/NativeMethods.cs"
+ "src/Compilers/Core/CommandLine/ConsoleUtil.cs"
+
"src/Compilers/Core/CommandLine/CompilerServerLogger.cs"))))))))
+ (synopsis "C# 8.0 compiler bootstrapped from source")
+ (description
+ "This package provides the Roslyn C# compiler (@command{csc}), built
+from source using @code{roslyn-2.8} as the bootstrap compiler. It produces
+a C# 8.0 compiler.")))
;; too new version: 15.9.21.664
;; too old (no support for mono) version: 14.0
(define-public msbuild
diff --git a/gnu/packages/patches/roslyn-3.0.0-bootstrap-with-csc-2.8.patch
b/gnu/packages/patches/roslyn-3.0.0-bootstrap-with-csc-2.8.patch
new file mode 100644
index 0000000000..dac5687aaf
--- /dev/null
+++ b/gnu/packages/patches/roslyn-3.0.0-bootstrap-with-csc-2.8.patch
@@ -0,0 +1,321 @@
+Author: Danny Milosavljevic <[email protected]>
+Date: 2026-04-08
+Subject: Avoid ReadOnlySpan since mono runtime doesn't have it. Avoid
CodePagesEncodingProvider.
+
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs
b/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs
+--- a/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs
2019-03-20 01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/Collections/ImmutableArrayExtensions.cs
2026-04-08 04:40:30.652729285 +0000
+@@ -508,9 +508,9 @@
+ // TODO(https://github.com/dotnet/corefx/issues/34126): Remove when
System.Collections.Immutable
+ // provides a Span API
+ internal static T[] DangerousGetUnderlyingArray<T>(this
ImmutableArray<T> array)
+- => Unsafe.As<ImmutableArray<T>, ImmutableArrayProxy<T>>(ref
array).MutableArray;
++ => array.ToArray();
+
+- internal static ReadOnlySpan<T> AsSpan<T>(this ImmutableArray<T>
array)
++ internal static T[] AsSpan<T>(this ImmutableArray<T> array)
+ => array.DangerousGetUnderlyingArray();
+
+ internal static Dictionary<K, ImmutableArray<T>> ToDictionary<K,
T>(this ImmutableArray<T> items, Func<T, K> keySelector, IEqualityComparer<K>
comparer = null)
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriter.cs
b/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriter.cs
+--- a/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriter.cs
2019-03-20 01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriter.cs
2026-04-08 04:40:30.662352748 +0000
+@@ -44,7 +44,7 @@
+ /// <exception cref="ObjectDisposedException">Object has been
disposed.</exception>
+ /// <exception cref="InvalidOperationException">Writes are not
allowed to the underlying stream.</exception>
+ /// <exception cref="SymUnmanagedWriterException">Error occurred
while writing PDB data.</exception>
+- public abstract int DefineDocument(string name, Guid language, Guid
vendor, Guid type, Guid algorithmId, ReadOnlySpan<byte> checksum,
ReadOnlySpan<byte> source);
++ public abstract int DefineDocument(string name, Guid language, Guid
vendor, Guid type, Guid algorithmId, byte[] checksum, byte[] source);
+
+ /// <summary>
+ /// Defines sequence points.
+@@ -127,8 +127,8 @@
+ int moveNextMethodToken,
+ int kickoffMethodToken,
+ int catchHandlerOffset,
+- ReadOnlySpan<int> yieldOffsets,
+- ReadOnlySpan<int> resumeOffsets);
++ int[] yieldOffsets,
++ int[] resumeOffsets);
+
+ /// <summary>
+ /// Associates custom debug information blob with the current method.
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriterImpl.cs
b/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriterImpl.cs
+---
a/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriterImpl.cs
2019-03-20 01:30:13.000000000 +0000
++++
b/src/Compilers/Core/Portable/DiaSymReader/Writer/SymUnmanagedWriterImpl.cs
2026-04-08 04:41:40.581693982 +0000
+@@ -137,7 +137,7 @@
+ }
+ }
+
+- public override int DefineDocument(string name, Guid language, Guid
vendor, Guid type, Guid algorithmId, ReadOnlySpan<byte> checksum,
ReadOnlySpan<byte> source)
++ public override int DefineDocument(string name, Guid language, Guid
vendor, Guid type, Guid algorithmId, byte[] checksum, byte[] source)
+ {
+ if (name == null)
+ {
+@@ -468,8 +468,8 @@
+ int moveNextMethodToken,
+ int kickoffMethodToken,
+ int catchHandlerOffset,
+- ReadOnlySpan<int> yieldOffsets,
+- ReadOnlySpan<int> resumeOffsets)
++ int[] yieldOffsets,
++ int[] resumeOffsets)
+ {
+ if (yieldOffsets == null) throw new
ArgumentNullException(nameof(yieldOffsets));
+ if (resumeOffsets == null) throw new
ArgumentNullException(nameof(resumeOffsets));
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/InternalUtilities/Hash.cs
b/src/Compilers/Core/Portable/InternalUtilities/Hash.cs
+--- a/src/Compilers/Core/Portable/InternalUtilities/Hash.cs 2019-03-20
01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/InternalUtilities/Hash.cs 2026-04-08
04:40:30.590942249 +0000
+@@ -180,7 +180,7 @@
+ /// <param name="data">The sequence of bytes that are likely to be
ASCII text.</param>
+ /// <param name="isAscii">True if the sequence contains only
characters in the ASCII range.</param>
+ /// <returns>The FNV-1a hash of <paramref name="data"/></returns>
+- internal static int GetFNVHashCode(ReadOnlySpan<byte> data, out bool
isAscii)
++ internal static int GetFNVHashCode(byte[] data, out bool isAscii)
+ {
+ int hashCode = Hash.FnvOffsetBias;
+
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/InternalUtilities/LittleEndianReader.cs
b/src/Compilers/Core/Portable/InternalUtilities/LittleEndianReader.cs
+--- a/src/Compilers/Core/Portable/InternalUtilities/LittleEndianReader.cs
2019-03-20 01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/InternalUtilities/LittleEndianReader.cs
2026-04-08 04:42:30.135720458 +0000
+@@ -1,62 +1,59 @@
+-// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache
License, Version 2.0. See License.txt in the project root for license
information.
+-
++// Bootstrap: rewritten to avoid ReadOnlySpan (csc 2.8 can't use its indexer).
+ using System;
+-using Roslyn.Utilities;
+-using static System.Buffers.Binary.BinaryPrimitives;
+
+-namespace Microsoft.CodeAnalysis
++namespace Roslyn.Utilities
+ {
+- /// <summary>
+- /// A Span-compatible version of <see cref="System.IO.BinaryReader"/>.
+- /// </summary>
+- internal ref struct LittleEndianReader
++ internal struct LittleEndianReader
+ {
+- private ReadOnlySpan<byte> _span;
++ private readonly byte[] _data;
++ private int _offset;
+
+- public LittleEndianReader(ReadOnlySpan<byte> span)
++ public LittleEndianReader(byte[] data)
+ {
+- _span = span;
++ _data = data;
++ _offset = 0;
+ }
+
+ internal uint ReadUInt32()
+ {
+- var result = ReadUInt32LittleEndian(_span);
+- _span = _span.Slice(sizeof(uint));
++ var result = (uint)(_data[_offset] | _data[_offset+1] << 8 |
++ _data[_offset+2] << 16 | _data[_offset+3] <<
24);
++ _offset += sizeof(uint);
+ return result;
+ }
+
+ internal byte ReadByte()
+ {
+- var result = _span[0];
+- _span = _span.Slice(sizeof(byte));
+- return result;
++ return _data[_offset++];
+ }
+
+ internal ushort ReadUInt16()
+ {
+- var result = ReadUInt16LittleEndian(_span);
+- _span = _span.Slice(sizeof(ushort));
++ var result = (ushort)(_data[_offset] | _data[_offset+1] << 8);
++ _offset += sizeof(ushort);
+ return result;
+ }
+
+- internal ReadOnlySpan<byte> ReadBytes(int byteCount)
++ internal byte[] ReadBytes(int byteCount)
+ {
+- var result = _span.Slice(0, byteCount);
+- _span = _span.Slice(byteCount);
++ var result = new byte[byteCount];
++ Array.Copy(_data, _offset, result, 0, byteCount);
++ _offset += byteCount;
+ return result;
+ }
+
+ internal int ReadInt32()
+ {
+- var result = ReadInt32LittleEndian(_span);
+- _span = _span.Slice(sizeof(int));
++ var result = _data[_offset] | _data[_offset+1] << 8 |
++ _data[_offset+2] << 16 | _data[_offset+3] << 24;
++ _offset += sizeof(int);
+ return result;
+ }
+
+- internal byte[] ReadReversed(int byteCount)
++ internal byte[] ReadReversed(int count)
+ {
+- var result = ReadBytes(byteCount).ToArray();
+- result.ReverseContents();
++ var result = ReadBytes(count);
++ Array.Reverse(result);
+ return result;
+ }
+ }
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/InternalUtilities/StringTable.cs
b/src/Compilers/Core/Portable/InternalUtilities/StringTable.cs
+--- a/src/Compilers/Core/Portable/InternalUtilities/StringTable.cs
2019-03-20 01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/InternalUtilities/StringTable.cs
2026-04-08 04:45:58.668140916 +0000
+@@ -109,7 +109,7 @@
+
+ internal string Add(char[] chars, int start, int len)
+ {
+- var span = chars.AsSpan(start, len);
++ var span = new string(chars, start, len).ToCharArray();
+ var hashCode = Hash.GetFNVHashCode(chars, start, len);
+
+ // capture array to avoid extra range checks
+@@ -295,7 +295,7 @@
+
+ if (e != null)
+ {
+- if (hash == hashCode && TextEquals(e, chars.AsSpan(start,
len)))
++ if (hash == hashCode && TextEquals(e, new string(chars,
start, len).ToCharArray()))
+ {
+ break;
+ }
+@@ -350,7 +350,7 @@
+ return e;
+ }
+
+- private static string FindSharedEntryASCII(int hashCode,
ReadOnlySpan<byte> asciiChars)
++ private static string FindSharedEntryASCII(int hashCode, byte[]
asciiChars)
+ {
+ var arr = s_sharedTable;
+ int idx = SharedIdxFromHash(hashCode);
+@@ -581,7 +581,7 @@
+ return text;
+ }
+
+- internal static string AddSharedUTF8(ReadOnlySpan<byte> bytes)
++ internal static string AddSharedUTF8(byte[] bytes)
+ {
+ bool isAscii;
+ int hashCode = Hash.GetFNVHashCode(bytes, out isAscii);
+@@ -598,13 +598,13 @@
+ return AddSharedSlow(hashCode, bytes, isAscii);
+ }
+
+- private static string AddSharedSlow(int hashCode, ReadOnlySpan<byte>
utf8Bytes, bool isAscii)
++ private static string AddSharedSlow(int hashCode, byte[] utf8Bytes,
bool isAscii)
+ {
+ string text;
+
+ unsafe
+ {
+- fixed (byte* bytes = &utf8Bytes.GetPinnableReference())
++ fixed (byte* bytes = utf8Bytes)
+ {
+ text = Encoding.UTF8.GetString(bytes, utf8Bytes.Length);
+ }
+@@ -711,7 +711,7 @@
+ return true;
+ }
+
+- internal static bool TextEqualsASCII(string text, ReadOnlySpan<byte>
ascii)
++ internal static bool TextEqualsASCII(string text, byte[] ascii)
+ {
+ #if DEBUG
+ for (var i = 0; i < ascii.Length; i++)
+@@ -736,7 +736,7 @@
+ return true;
+ }
+
+- internal static bool TextEquals(string array, ReadOnlySpan<char> text)
+- => text.Equals(array.AsSpan(), StringComparison.Ordinal);
++ internal static bool TextEquals(string array, char[] text)
++ => string.Equals(new string(text), array,
StringComparison.Ordinal);
+ }
+ }
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/InternalUtilities/TextKeyedCache.cs
b/src/Compilers/Core/Portable/InternalUtilities/TextKeyedCache.cs
+--- a/src/Compilers/Core/Portable/InternalUtilities/TextKeyedCache.cs
2019-03-20 01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/InternalUtilities/TextKeyedCache.cs
2026-04-08 04:43:25.581261044 +0000
+@@ -118,7 +118,7 @@
+
+ if (text != null && localSlot.HashCode == hashCode)
+ {
+- if (StringTable.TextEquals(text, chars.AsSpan(start, len)))
++ if (StringTable.TextEquals(text, new string(chars, start,
len).ToCharArray()))
+ {
+ return localSlot.Item;
+ }
+@@ -155,7 +155,7 @@
+
+ if (e != null)
+ {
+- if (hash == hashCode && StringTable.TextEquals(e.Text,
chars.AsSpan(start, len)))
++ if (hash == hashCode && StringTable.TextEquals(e.Text,
new string(chars, start, len).ToCharArray()))
+ {
+ break;
+ }
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs
b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs
+--- a/src/Compilers/Core/Portable/MetadataReader/PEModule.cs 2019-03-20
01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/MetadataReader/PEModule.cs 2026-04-08
04:40:42.540150457 +0000
+@@ -3151,7 +3151,7 @@
+
+ public unsafe override string GetString(byte* bytes, int
byteCount)
+ {
+- return StringTable.AddSharedUTF8(new
ReadOnlySpan<byte>(bytes, byteCount));
++ var arr = new byte[byteCount];
System.Runtime.InteropServices.Marshal.Copy((System.IntPtr)bytes, arr, 0,
byteCount); return StringTable.AddSharedUTF8(arr);
+ }
+ }
+
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs
b/src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs
+--- a/src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs 2019-03-20
01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/NativePdbWriter/PdbWriter.cs 2026-04-08
04:40:30.630288586 +0000
+@@ -573,8 +573,8 @@
+ }
+
+ Guid algorithmId;
+- ReadOnlySpan<byte> checksum;
+- ReadOnlySpan<byte> embeddedSource;
++ byte[] checksum;
++ byte[] embeddedSource;
+
+ DebugSourceInfo info = document.GetSourceInfo();
+ if (!info.Checksum.IsDefault)
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs
b/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs
+--- a/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs
2019-03-20 01:30:13.000000000 +0000
++++ b/src/Compilers/Core/Portable/StrongName/CryptoBlobParser.cs
2026-04-08 04:41:40.581488708 +0000
+@@ -153,7 +153,7 @@
+ uint magic,
+ uint bitLen,
+ uint pubExp,
+- ReadOnlySpan<byte> pubKeyData)
++ byte[] pubKeyData)
+ {
+ var w = new BlobWriter(3 * sizeof(uint) + s_offsetToKeyData +
pubKeyData.Length);
+ w.WriteUInt32(AlgorithmId.RsaSign);
+@@ -250,7 +250,7 @@
+ /// Helper for RsaCryptoServiceProvider.ExportParameters()
+ /// Copied from
https://github.com/dotnet/corefx/blob/5fe5f9aae7b2987adc7082f90712b265bee5eefc/src/System.Security.Cryptography.Csp/src/System/Security/Cryptography/CapiHelper.Shared.cs
+ /// </summary>
+- internal static RSAParameters ToRSAParameters(this ReadOnlySpan<byte>
cspBlob, bool includePrivateParameters)
++ internal static RSAParameters ToRSAParameters(this byte[] cspBlob,
bool includePrivateParameters)
+ {
+ var br = new LittleEndianReader(cspBlob);
+
+diff -ruN '--exclude=*.resx' '--exclude=*.xlf' '--exclude=*.xml'
'--exclude=*.rsp' '--exclude=srm-src-patched' '--exclude=*.resources'
'--exclude=bootstrap-*' '--exclude=*.dll' '--exclude=*.exe'
'--exclude=srm-strings.cs' '--exclude=generated'
a/src/Compilers/Shared/DesktopBuildClient.cs
b/src/Compilers/Shared/DesktopBuildClient.cs
+--- a/src/Compilers/Shared/DesktopBuildClient.cs 2019-03-20
01:30:13.000000000 +0000
++++ b/src/Compilers/Shared/DesktopBuildClient.cs 2026-04-08
04:48:35.412540299 +0000
+@@ -33,7 +33,7 @@
+ {
+ // Register encodings for console
+ // https://github.com/dotnet/roslyn/issues/10785
+-
System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
++ // CodePagesEncodingProvider not available in Mono
+ }
+
+ var client = new DesktopBuildClient(language, compileFunc,
analyzerAssemblyLoader);