-
Notifications
You must be signed in to change notification settings - Fork 56
Description
Describe the bug
Compiler throws errors and fails to build assemblies when trying to build ComicRackCE.
Related to C# 14.0 Enumerable.Reverse breaking change.
Exact Steps to Reproduce
VS 2022
- Have the latest VS 2022 installed (17.14.20)
- MSBuild version: 17.14.23.0
- Clone and try to build any branch
VS 2026
- Have the latest VS 2026 installed (11206.111)
- MSBuild version: 18.1.0.0
- Clone and try to build any branch
Screenshots
cYo.Common.Windows and ComicRack project errors get raised once these are fixed. See end for relevant lines of code.
As text
Severity Code Description Project File Line Suppression State
Error (active) CS1579 foreach statement cannot operate on variables of type 'void' because 'void' does not contain a public instance or extension definition for 'GetEnumerator' cYo.Common cYo.Common\Mathematics\Numeric.cs 261
Error (active) CS1936 Could not find an implementation of the query pattern for source type 'void'. 'Select' not found. cYo.Common.Presentation cYo.Common.Presentation\Panels\OverlayManager.cs 227
Error (active) CS1579 foreach statement cannot operate on variables of type 'void' because 'void' does not contain a public instance or extension definition for 'GetEnumerator' cYo.Common.Presentation cYo.Common.Presentation\Panels\OverlayPanel.cs 690
Version
VS 2022 17.14.20 + MSBuild 17.14.23.0
VS 2026 11206.111 + MSBuild 18.1.0.0
Additional context
When using C# 14 or newer and targeting a .NET older than
net10.0or .NET Framework withSystem.Memoryreference, there is a breaking change withEnumerable.Reverseand arrays.
-
C# 14.0 has been out for a while; this only became a problem on upgrading to the latest VS 2022.
-
Bug might only impact those using VS 2022/2026 and with the .NET 10 SDK installed
Relevant lines of code
ComicRackCE/ComicRack/Dialogs/Splash.cs
Line 256 in 9cca27e
| string[] array = message.Split('\n').Reverse().Take(messageLines) |
| foreach (ComicBook item in source.Reverse()) |
| foreach (ComicBook item in source.Reverse()) |
ComicRackCE/cYo.Common/Mathematics/Numeric.cs
Line 261 in 9cca27e
| foreach (bool item in flags.Reverse()) |
| foreach (ToolStripMenuItem item in array2.Reverse()) |
| return (from op in panels.ToArray().Reverse() |
| foreach (OverlayPanel item in panels.ToArray().Reverse()) |
