Skip to content

Conversation

@am11
Copy link
Member

@am11 am11 commented Sep 22, 2024

This strongly-typed enums based implementation is not scaling very well; but for now, lets add 10.0 and soon after lets see if we can make it less verbose to ease up future updates a bit: dotnet/runtime#106599 (comment)

cc @adamsitnik, @lewing

@am11 am11 marked this pull request as ready for review September 22, 2024 16:49
@caaavik-msft
Copy link
Contributor

I've tested this PR against a local build from dotnet/runtime#106599 and it fails because it seems that the .NET 10 SDK doesn't actually allow to target .NET 10, rather it only allows targetting .NET 9. To get things to work we do need to make changes to the SDK validator to allow backwards compatibility. However, this change will still be useful to have in once we do have .NET 10 targeting supported

@am11
Copy link
Member Author

am11 commented Sep 23, 2024

Yup, it's a chicken-egg situation atm, and we will soon be on alpha1 in runtime repo (based on how it was done last year, around this time). I think we can pass --corerun option in local builds that points to built corerun under artifacts/bin or artifacts/tests/coreclr/<platform>/Tests/Core_Root to get the ball rolling?

Copy link
Collaborator

@timcassell timcassell Oct 20, 2024

Choose a reason for hiding this comment

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

GitHub won't let me add a comment on the actual line... I think the TryParse method needs to be updated to account for the underscore.

internal static bool TryParse(string runtime, out RuntimeMoniker runtimeMoniker) { int index = runtime.IndexOf('-'); if (index >= 0) { runtime = runtime.Substring(0, index); } // Monikers older than Net 10 don't use any version delimiter, newer monikers use _ delimiter. if (Enum.TryParse(runtime.Replace(".", string.Empty), ignoreCase: true, out runtimeMoniker)) { return true; } return Enum.TryParse(runtime.Replace('.', '_'), ignoreCase: true, out runtimeMoniker); }

I don't have a 10.0 sdk version, so I didn't test.

Comment on lines 388 to +391
[InlineData("net70")]
[InlineData("net80")]
[InlineData("net90")]
[InlineData("net10_0")]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
[InlineData("net70")]
[InlineData("net80")]
[InlineData("net90")]
[InlineData("net10_0")]
[InlineData("net7.0")]
[InlineData("net8.0")]
[InlineData("net9.0")]
[InlineData("net10.0")]
@am11
Copy link
Member Author

am11 commented Oct 20, 2024

IMHO the best direction would be to introduce something similar to the [SupportedOSPlatform], such as [SupportedFramework("netX.0")], which would provide indefinite scalability. The current hardcoded enum approach doesn't scale well, which was precisely why [SupportedPlatform("")] (introduced in .NET 5.0) was designed to be string-based instead of enum-based—managing an enum over the years would have been a maintenance nightmare.

This transition to .NET 10.0 might be an ideal time to consider such a change and start deprecating the old enum, with the goal of fully removing it after a few release cycles. Additionally, pseudo-TFMs like nativeaot9.0 feel somewhat unnatural compared to the broader ecosystem’s conventions, such as using net9.0 combined with --aot (e.g., dotnet new console -f net9.0 --aot) or simply setting PublishAot=true.

@timcassell
Copy link
Collaborator

I don't understand how [SupportedFramework("netX.0")] would be used. I think you should open an issue with more details rather than discuss it here. And/or create a WIP PR showcasing a new system.

@LoopedBard3
Copy link
Member

I think now may be a good time to revisit this PR. Is there anything specifically blocking it or just another pass to clean up the suggested changes? We are hitting an issue for our performance wasm testing due to wasmnet100/wasmnet10_0. FYI @caaavik-msft

@LoopedBard3
Copy link
Member

@timcassell is there anything else that needs to be done before merging this? It seems maybe the TryParse update, but wanted to check if there was anything else.

@timcassell
Copy link
Collaborator

timcassell commented Jan 3, 2025

I think that's the only thing. And the test cases.

@timcassell
Copy link
Collaborator

@LoopedBard3 Regarding wasm specifically, you could also send a PR to fix the wasm logic so you can use the simple Wasm moniker and not need to continually update the moniker every year. #2641 (comment)

@LoopedBard3
Copy link
Member

I have a PR against the base branch for this PR here: am11#1. If @am11 accepts it or makes the changes, we should merge this, otherwise I will make a new PR tomorrow and link it back to this one.

Copy link
Member

@adamsitnik adamsitnik left a comment

Choose a reason for hiding this comment

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

LGTM. Since .NET Team needs it, I am going to merge it in the current form and cherry pick changes from https://github.com/am11/BenchmarkDotNet/pull/1/files.

Thank you @am11 and others involved!

"choices": [
{
"choice": "net10.0",
"description": ".NET 10"
Copy link
Member

Choose a reason for hiding this comment

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

.NET 10 is not even in Preview 1 yet so we don't have to update the templates right now. But on the other hand if we don't do it now, we may simply forget about it. So let's merge it in the current form

@adamsitnik adamsitnik merged commit 3337a09 into dotnet:master Jan 7, 2025
8 checks passed
@adamsitnik adamsitnik added this to the v0.14.1 milestone Jan 8, 2025
@LoopedBard3 LoopedBard3 mentioned this pull request Dec 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants