microsoft-authentication-library-for-dotnet
microsoft-authentication-library-for-dotnet copied to clipboard
update to langVersion 13
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
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?
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
Might be MSAL specific, we are finding 13 working well on linux.
This was closed without a comment, please provide the reason