Skip to content

Commit 3c0aa37

Browse files
committed
fix: restore Roslyn 4.8 band so .NET 8 SDK users work again
3.0.0 dropped the 4.8/4.12 analyzer bands, shipping only roslyn4.14 + roslyn5.0. The compiler selects the highest analyzer band <= its own Roslyn version, so every .NET 8 SDK (Roslyn 4.8 in 8.0.1xx through 4.11 in 8.0.4xx) found no matching band and the generators stopped loading; the version-less code-fix assembly, built against 4.14, also tripped CS9057. .NET 8 is supported through Nov 2026, so restore support: - Re-add the generator's roslyn4.8 band, correctly pinned to Microsoft.CodeAnalysis 4.8.0 (the old Roslyn480 project had no VersionOverride and silently resolved to 4.14 under CPM). The 4.12+ API surface stays compiled out via the absent ROSYLN_412 constant. - Pin the version-less code-fix assembly to 4.8.0 as well. It loads on every host, and building against the oldest supported API keeps it forward-compatible (4.8 -> 5.0) with no CS9057, so -warnaserror .NET 8 builds are unaffected. - Pack three bands: roslyn4.8 (whole .NET 8 line + VS 17.12/17.13), roslyn4.14 (VS 17.14 / .NET 9), roslyn5.0 (VS 2026 / .NET 10). - Drop the EOL net9 MAUI sample TFMs (net10 only). Build + 891 tests green on net8/9/10; pack verified to contain analyzers/dotnet/roslyn4.8/cs.
1 parent 7f3d743 commit 3c0aa37

6 files changed

Lines changed: 75 additions & 20 deletions

File tree

README.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,23 @@ Splat.Locator.CurrentMutable.RegisterViewsForViewModelsSourceGenerated();
7373

7474
### Roslyn / Visual Studio support
7575

76-
The generators ship two Roslyn analyzer bands and the matching one is selected automatically by your compiler:
76+
The generators ship three Roslyn analyzer bands and the matching one is selected automatically by your compiler (it picks the highest band that is less than or equal to its own Roslyn version):
7777

78-
| Band (`analyzers/dotnet/...`) | Roslyn | Minimum tooling |
79-
| --- | --- | --- |
80-
| `roslyn4.14` | 4.14 | Visual Studio 2022 17.14, .NET SDK 9.0.3xx |
81-
| `roslyn5.0` | 5.0 | Visual Studio 2026, .NET 10 SDK |
78+
| Band (`analyzers/dotnet/...`) | Roslyn | Minimum tooling | Covers |
79+
| --- | --- | --- | --- |
80+
| `roslyn4.8` | 4.8 | Visual Studio 2022 17.8, .NET 8 SDK (8.0.1xx) | The whole .NET 8 SDK line (Roslyn 4.8–4.11) plus VS 17.12/17.13 (Roslyn 4.12/4.13) |
81+
| `roslyn4.14` | 4.14 | Visual Studio 2022 17.14, .NET SDK 9.0.3xx | VS 17.14, current .NET 9 SDK |
82+
| `roslyn5.0` | 5.0 | Visual Studio 2026, .NET 10 SDK | VS 2026, .NET 10 SDK |
8283

83-
Roslyn 4.14 is the baseline: 17.14 is the only [Visual Studio 2022](https://learn.microsoft.com/en-us/lifecycle/products/visual-studio-2022) servicing baseline still in support, so the 4.8 and 4.12 bands are not shipped.
84+
The **`roslyn4.8` baseline keeps the entire .NET 8 SDK line working** — .NET 8 is supported through November 2026 and its SDK feature bands carry Roslyn 4.8 (`8.0.1xx`) through 4.11 (`8.0.4xx`); all of them select the `roslyn4.8` band. The 4.8 band compiles against the Roslyn 4.8 API only (the 4.12+ surface is compiled out), so it loads on those compilers without the `CS9057` "analyzer references a newer compiler" error. See the official [Roslyn package version mappings](https://learn.microsoft.com/en-us/visualstudio/extensibility/roslyn-version-support).
8485

85-
| Visual Studio 2022 LTSC | Roslyn | End of support |
86+
| Visual Studio 2022 LTSC | Roslyn | .NET SDK band |
8687
| --- | --- | --- |
87-
| 17.8 | 4.8 | 2025-07-08 |
88-
| 17.12 | 4.12 | 2026-07-14 |
89-
| 17.14 | 4.14 | 2032-01-13 |
90-
91-
To use these generators, build with Visual Studio 2022 17.14+ (or Visual Studio 2026 / .NET 10 SDK), or stay on a previous release of this package.
88+
| 17.8 | 4.8 | 8.0.1xx |
89+
| 17.9 | 4.9 | 8.0.2xx |
90+
| 17.10 | 4.10 | 8.0.3xx |
91+
| 17.11 | 4.11 | 8.0.4xx |
92+
| 17.14 | 4.14 | 9.0.3xx |
9293

9394
For more information on analyzer codes, see the [analyzer codes documentation](https://github.com/reactiveui/ReactiveUI.SourceGenerators/blob/main/src/ReactiveUI.SourceGenerators/AnalyzerReleases.Shipped.md).
9495

src/Directory.Build.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@
4949
<!-- MAUI TFMs with OS-specific conditional logic -->
5050
<PropertyGroup>
5151
<!-- Linux builds Android targets only -->
52-
<MauiTfms Condition="$([MSBuild]::IsOSPlatform('Linux'))">net9.0-android;net10.0-android</MauiTfms>
52+
<MauiTfms Condition="$([MSBuild]::IsOSPlatform('Linux'))">net10.0-android</MauiTfms>
5353
<!-- macOS builds Android and Apple (iOS/MacCatalyst) targets -->
54-
<MauiTfms Condition="$([MSBuild]::IsOSPlatform('OSX'))">net9.0-android;net9.0-ios;net9.0-maccatalyst;net10.0-android;net10.0-ios;net10.0-maccatalyst</MauiTfms>
54+
<MauiTfms Condition="$([MSBuild]::IsOSPlatform('OSX'))">net10.0-android;net10.0-ios;net10.0-maccatalyst</MauiTfms>
5555
<!-- Windows builds Android, Windows, and Apple targets (assuming paired Mac) -->
56-
<MauiTfms Condition="$([MSBuild]::IsOSPlatform('Windows'))">net9.0-android;net9.0-ios;net9.0-maccatalyst;net9.0-windows10.0.19041.0;net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.19041.0</MauiTfms>
56+
<MauiTfms Condition="$([MSBuild]::IsOSPlatform('Windows'))">net10.0-android;net10.0-ios;net10.0-maccatalyst;net10.0-windows10.0.19041.0</MauiTfms>
5757
</PropertyGroup>
5858

5959
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">

src/ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,15 @@
1717
<PackageDescription>A MVVM framework that integrates with the Reactive Extensions for .NET to create elegant, testable User Interfaces that run on any mobile or desktop platform. This is the Source Generators package for ReactiveUI</PackageDescription>
1818
</PropertyGroup>
1919

20+
<!-- Pinned to 4.8.0: the code-fix assembly ships in the version-less analyzers/dotnet/cs
21+
folder, which the compiler loads on EVERY host. Building it against the 4.8 API keeps it
22+
forward-compatible on all hosts (4.8 -> 5.0) with no CS9057 (that warning only fires when an
23+
analyzer references a NEWER compiler than the running one), so .NET 8 (Roslyn 4.8) consumers
24+
— including -warnaserror builds — are not broken by the code fixes. -->
2025
<ItemGroup>
21-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" />
22-
<PackageReference Include="Microsoft.CodeAnalysis.Common" PrivateAssets="all" />
23-
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" PrivateAssets="all" />
26+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" VersionOverride="4.8.0" />
27+
<PackageReference Include="Microsoft.CodeAnalysis.Common" PrivateAssets="all" VersionOverride="4.8.0" />
28+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" PrivateAssets="all" VersionOverride="4.8.0" />
2429
</ItemGroup>
2530

2631
<!-- This ensures the library will be packaged as a source generator when we use `dotnet pack` -->
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(RoslynTfm)</TargetFramework>
5+
<Nullable>enable</Nullable>
6+
<LangVersion>latest</LangVersion>
7+
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
8+
<IsRoslynComponent>true</IsRoslynComponent>
9+
<EnforceExtendedAnalyzerRules>true</EnforceExtendedAnalyzerRules>
10+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
11+
<IncludeBuildOutput>false</IncludeBuildOutput>
12+
<DevelopmentDependency>true</DevelopmentDependency>
13+
<IsPackable>false</IsPackable>
14+
15+
<PackageDescription>A MVVM framework that integrates with the Reactive Extensions for .NET to create elegant, testable User Interfaces that run on any mobile or desktop platform. This is the Source Generators package for ReactiveUI</PackageDescription>
16+
<AssemblyName>ReactiveUI.SourceGenerators</AssemblyName>
17+
<!-- Roslyn 4.8 baseline band (VS 2022 17.8, .NET 8.0.1xx SDK). No ROSYLN_412 — the
18+
4.12+ API surface is compiled out, so this band compiles against the 4.8 API only. -->
19+
</PropertyGroup>
20+
21+
<ItemGroup>
22+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" VersionOverride="4.8.0" />
23+
<PackageReference Include="Microsoft.CodeAnalysis.Common" PrivateAssets="all" VersionOverride="4.8.0" />
24+
<PackageReference Include="Microsoft.CodeAnalysis.Workspaces.Common" PrivateAssets="all" VersionOverride="4.8.0" />
25+
<PackageReference Include="Microsoft.CodeAnalysis" PrivateAssets="all" VersionOverride="4.8.0" />
26+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" PrivateAssets="all" VersionOverride="4.8.0" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<InternalsVisibleTo Include="ReactiveUI.CodeFixes" />
31+
</ItemGroup>
32+
33+
<ItemGroup>
34+
<Compile Include="..\ReactiveUI.SourceGenerators.Roslyn\**\*.cs" LinkBase="Shared" />
35+
</ItemGroup>
36+
37+
<ItemGroup>
38+
<AdditionalFiles Include="..\ReactiveUI.SourceGenerators.Roslyn\AnalyzerReleases.Shipped.md" />
39+
<AdditionalFiles Include="..\ReactiveUI.SourceGenerators.Roslyn\AnalyzerReleases.Unshipped.md" />
40+
</ItemGroup>
41+
42+
</Project>

src/ReactiveUI.SourceGenerators.slnx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
</Folder>
2323
<Project Path="ReactiveUI.SourceGenerator.Tests/ReactiveUI.SourceGenerators.Tests.csproj" />
2424
<Project Path="ReactiveUI.SourceGenerators.Analyzers.CodeFixes/ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj" />
25+
<Project Path="ReactiveUI.SourceGenerators.Roslyn480/ReactiveUI.SourceGenerators.Roslyn480.csproj" />
2526
<Project Path="ReactiveUI.SourceGenerators.Roslyn4140/ReactiveUI.SourceGenerators.Roslyn4140.csproj" />
2627
<Project Path="ReactiveUI.SourceGenerators.Roslyn5000/ReactiveUI.SourceGenerators.Roslyn5000.csproj" />
2728
<Project Path="ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj" />

src/ReactiveUI.SourceGenerators/ReactiveUI.SourceGenerators.csproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,18 @@
3131
<ProjectReference Include="..\ReactiveUI.SourceGenerators.Analyzers.CodeFixes\ReactiveUI.SourceGenerators.Analyzers.CodeFixes.csproj" />
3232
<ProjectReference Include="..\ReactiveUI.SourceGenerators.Roslyn5000\ReactiveUI.SourceGenerators.Roslyn5000.csproj" ReferenceOutputAssembly="false" />
3333
<ProjectReference Include="..\ReactiveUI.SourceGenerators.Roslyn4140\ReactiveUI.SourceGenerators.Roslyn4140.csproj" ReferenceOutputAssembly="false" />
34+
<ProjectReference Include="..\ReactiveUI.SourceGenerators.Roslyn480\ReactiveUI.SourceGenerators.Roslyn480.csproj" ReferenceOutputAssembly="false" />
3435
</ItemGroup>
3536

3637
<!-- This ensures the library will be packaged as a source generator when we use `dotnet pack`.
37-
Only Roslyn 4.14 (VS 2022 17.14 — the only serviced VS 2022 baseline) and 5.0 (VS 2026) are
38-
shipped; the 4.8/4.12 bands were dropped — see README for the rationale. -->
38+
Three Roslyn bands ship; the compiler auto-selects the highest one <= its own version:
39+
roslyn4.8 — VS 2022 17.8+, the whole .NET 8 SDK line (8.0.1xx Roslyn 4.8 .. 8.0.4xx Roslyn 4.11)
40+
plus VS 17.12/17.13 (Roslyn 4.12/4.13), since the next band is 4.14
41+
roslyn4.14 — VS 2022 17.14, .NET SDK 9.0.3xx
42+
roslyn5.0 — VS 2026, .NET 10 SDK
43+
The 4.8 baseline keeps the supported .NET 8 line (through Nov 2026) working — see README. -->
3944
<ItemGroup>
45+
<None Include="..\ReactiveUI.SourceGenerators.Roslyn480\bin\$(Configuration)\netstandard2.0\ReactiveUI.SourceGenerators.dll" PackagePath="analyzers\dotnet\roslyn4.8\cs" Pack="true" Visible="false" />
4046
<None Include="..\ReactiveUI.SourceGenerators.Roslyn4140\bin\$(Configuration)\netstandard2.0\ReactiveUI.SourceGenerators.dll" PackagePath="analyzers\dotnet\roslyn4.14\cs" Pack="true" Visible="false" />
4147
<None Include="..\ReactiveUI.SourceGenerators.Roslyn5000\bin\$(Configuration)\netstandard2.0\ReactiveUI.SourceGenerators.dll" PackagePath="analyzers\dotnet\roslyn5.0\cs" Pack="true" Visible="false" />
4248
</ItemGroup>

0 commit comments

Comments
 (0)