Skip to content

update to langVersion 13 #5313

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

update to langVersion 13 #5313

wants to merge 1 commit into from

Conversation

jennyf19
Copy link
Collaborator

Downlevel "latest" maps to pre-13. In the future, we'll want to either keep this up-to-date (e.g. update it to 14 when .NET 10 ships) or change it to preview, which will always be up-to-date.

note: I haven't tested anything

@jennyf19 jennyf19 requested a review from a team as a code owner May 31, 2025 03:20
@Frulfump
Copy link

Moving away from latest is supported by the documentation https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/configure-language-version

Warning

Setting the LangVersion element to latest is discouraged. The latest setting means the installed compiler uses its latest version. The value of latest can change from machine to machine, making builds unreliable. In addition, it enables language features that might require runtime or library features not included in the current SDK.

But the documentation also talks about the defaults

In Visual Studio, the option to change the language version through the UI is disabled because the default version is aligned with the project's target framework (TFM). This default configuration ensures compatibility between language features and runtime support. To change the language version in Visual Studio, change the project's target framework.

For example, changing the target TFM (for example, from [.NET 6](https://dotnet.microsoft.com/en-us/download/dotnet/6.0) to [.NET 9](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)) updates the language version accordingly, from C# 10 to C# 13. This approach prevents issues with runtime compatibility and minimizes unexpected build errors due to unsupported language features.

If you need a specific language version that differs from the one automatically selected, refer to the methods in this article to override the default settings directly in the project file.

Which is why I wanted to higlight that, so maybe the correct solution is to remove the property altogether?

@trwalke
Copy link
Member

trwalke commented Jun 4, 2025

Language version 13 is not available on the linux agents
"CSC(0,0): Error CS1617: Invalid option '13' for /langversion. Use '/langversion:?' to list supported values."
We will need to wait for the build agents to be updated to the later versions. So not sure if setting to a specific value will work best here. Different agents we use may have different supported versions at different times. Maybe preview will be better? or not setting it at all so that the compiler can choose the correct version?

Need some additional testing

Copy link
Member

@trwalke trwalke left a comment

Choose a reason for hiding this comment

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

Need to fix linux build

@bgavrilMS bgavrilMS marked this pull request as draft June 24, 2025 18:20
@MZOLN
Copy link

MZOLN commented Jun 24, 2025

Might be MSAL specific, we are finding 13 working well on linux.

@bgavrilMS bgavrilMS closed this Jul 9, 2025
@Frulfump
Copy link

Frulfump commented Jul 9, 2025

This was closed without a comment, please provide the reason

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants