Skip to content

Bump .NET SDK to 10 - #4326

Open
YoshiRulz wants to merge 4 commits into
masterfrom
dotnet-sdk-10
Open

YoshiRulz wants to merge 4 commits into
masterfrom
dotnet-sdk-10

Conversation

@YoshiRulz

@YoshiRulz YoshiRulz commented May 20, 2025 •

Copy link
Copy Markdown
Contributor

This should be delayed until at least 2026-01 so people have time to update their toolchains. C# 14 is sorely needed. VS2026 and Rider 2025.3 are out and ready for .NET 10.

A change for all our Analyzers which use marker attributes (such as [CoreSettings], [FeatureNotImplemented], or [PeripheralOption], except none of those 3 are eligible in master) is to call initContext.AddEmbeddedAttributeDefinition();, new in Roslyn 4.14, and add [Embedded] on those attributes. That can be done in a later PR.

C# 14 brings the field keyword, which will help clean up a lot. And then I could write a Source Generator to clean up even more. Neither will be adopted in this PR though.

C# 14 expands on extension methods with extension props, which newer versions of Meziantou.Polyfill are already taking advantage of to add more polyfills. (Incidentally, bumping it to >= 1.0.53 causes MSBuild to fail, will investigate later.) I'm sure we could replace some of our extension methods with extension props too but that's not for this PR.

Remember to update the ApiHawk quickstart guide after this.

Did have a migration to .slnx (#4097), but decided to split it off and wait until the format is fully-documented.
Also split off some code style fixes which aren't urgent.

@YoshiRulz YoshiRulz added this to the 2.10.2 milestone May 20, 2025
@YoshiRulz
YoshiRulz force-pushed the dotnet-sdk-10 branch 2 times, most recently from 7959d59 to 51e0c3a Compare September 8, 2025 07:51
@YoshiRulz YoshiRulz added the Meta Relating to code organisation or to things that aren't code label Sep 26, 2025
@YoshiRulz YoshiRulz added the re: Metaprogramming Roslyn Analyzers and Source Generators label Oct 14, 2025
@YoshiRulz
YoshiRulz force-pushed the dotnet-sdk-10 branch 3 times, most recently from a503d43 to eddff78 Compare November 16, 2025 11:56
@YoshiRulz
YoshiRulz marked this pull request as ready for review November 16, 2025 11:57
Comment thread ExternalProjects/BizHawk.Analyzer/BrokenCollectionExpressionAnalyzer.cs Outdated
Comment thread ExternalProjects/BizHawk.Analyzer/BrokenCollectionExpressionAnalyzer.cs Outdated
Comment thread BizHawk.slnx Outdated
Comment thread BizHawk.slnx Outdated

@Morilli Morilli left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should probably get this in soon-ish. Dotnet 8 goes EOL in november 2026.

Comment thread Directory.Packages.props Outdated
Comment thread README.md Outdated
Comment thread ExternalProjects/BizHawk.Analyzer/BrokenCollectionExpressionAnalyzer.cs Outdated
Comment thread src/MainSlnCommon.props
<InternalsVisibleTo Include="$(MSBuildProjectName.Replace('BizHawk.', 'BizHawk.Tests.'))" />
<Using Include="System" />
<Using Include="System.Object" Alias="Lock" />
<Using Include="System.Threading.Lock" Alias="Lock" />

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering this is now a proper type and has a dedicated namespace,is this alias and global using still useful?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this PR also bumps $(LangVersion), it would be fine to import the whole namespace:

Suggested change
<Using Include="System.Threading.Lock" Alias="Lock" />
<Using Include="System.Threading" />

...except doing that results in a few "ambiguous reference" errors (System.{Threading,Windows.Forms}.Timer) and a bunch of "redundant import" warnings.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be fine to import the whole namespace ... except doing that results in a few "ambiguous reference" errors

Yeah that's not a good alternative either, what I'm mainly asking is: Is such a global using even sensible now that a namespace+explicit type for Lock exists? Is there a reason to make this type available everywhere without requiring a using statement? I don't really care too much, but it feels arbitrary.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see. No, there's no reason it couldn't be imported when needed. I don't care enough to change it either.

@vadosnaprimer

Copy link
Copy Markdown
Contributor

Works fine with Rider 2025.3 so I'll live. But do non-developer users have to install anything new?

@YoshiRulz

Copy link
Copy Markdown
Contributor Author

No, still targeting net48, and CI does the building.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Meta Relating to code organisation or to things that aren't code re: Metaprogramming Roslyn Analyzers and Source Generators

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants