Skip to content

использовать версию C# в соответствии с фреймворком#1687

Open
Mr-Rm wants to merge 1 commit into
EvilBeaver:developfrom
Mr-Rm:feat/LangVersion
Open

использовать версию C# в соответствии с фреймворком#1687
Mr-Rm wants to merge 1 commit into
EvilBeaver:developfrom
Mr-Rm:feat/LangVersion

Conversation

@Mr-Rm
Copy link
Copy Markdown
Collaborator

@Mr-Rm Mr-Rm commented May 26, 2026

Раз используется .NET 8.0, то почему не перейти к C#12?

Summary by CodeRabbit

  • Chores
    • Updated C# language version setting in build configuration to use the default compiler version instead of explicitly specifying version 8.0.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 26, 2026

📝 Walkthrough

Walkthrough

This PR updates the default C# language version setting in the MSBuild project configuration file. The explicit LangVersion value of 8.0 is replaced with default, allowing the project to use the compiler's default language version instead of being pinned to a specific version.

Changes

Build Configuration

Layer / File(s) Summary
Language version property update
src/oscommon.targets
The <LangVersion> property is changed from 8.0 to default in the project's default build property group.

🎯 1 (Trivial) | ⏱️ ~2 minutes

🐰 A version once fixed at eight, now defaults to whatever fate,
The rabbit hops with glee so bright, letting the compiler choose what's right!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title accurately describes the main change: updating the C# language version setting to align with the framework version being used.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/oscommon.targets`:
- Line 9: src/oscommon.targets sets <LangVersion>default with
<TargetFrameworkVersion>net8.0 which promotes all importing projects to C# 12
and may break or warn in many projects; build the solution and either fix C#
12-compatibility issues or explicitly pin LangVersion per-project for those that
must stay on an older compiler. Specifically: run a full build of
src/1Script.sln and all test projects, address any new C#12 errors/warnings (fix
syntax/API uses or adjust code), and for projects that must remain on earlier
versions override <LangVersion> in their .csproj (examples include
VSCode.DebugAdapter.csproj, DocumenterTests.csproj, OneScriptDocumenter.csproj,
OneScript.Dynamic.Tests.csproj, OneScript.Core.Tests.csproj,
OneScript.Web.Server.csproj) or change src/oscommon.targets to a conservative
default; ensure all fixes remove build failures and test regressions.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba7ba74c-56c6-4bf8-9107-d52cc9706edc

📥 Commits

Reviewing files that changed from the base of the PR and between 3c3984c and 1c7e57a.

📒 Files selected for processing (1)
  • src/oscommon.targets

Comment thread src/oscommon.targets
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<Platform Condition="'$(Platform)' == ''">x86</Platform>
<LangVersion>8.0</LangVersion>
<LangVersion>default</LangVersion>
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Description: Find all .csproj files that import oscommon.targets

echo "=== Projects importing oscommon.targets ==="
rg -t xml '<Import.*oscommon\.targets' --glob '*.csproj' -n

echo ""
echo "=== Projects with explicit LangVersion (unaffected) ==="
rg -t xml '<LangVersion>' --glob '*.csproj' -n -C2

Repository: EvilBeaver/OneScript

Length of output: 5406


🏁 Script executed:

#!/bin/bash
# Description: Attempt a full build to verify C# 12 compatibility

echo "=== Building solution to verify C# 12 compatibility ==="
# Find solution files
fd -e sln -x echo "Found solution: {}"

echo ""
echo "Note: Please run 'dotnet build' or your build command locally to verify all projects compile successfully with C# 12."

Repository: EvilBeaver/OneScript

Length of output: 273


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== src/oscommon.targets (top 40 lines) ==="
nl -ba src/oscommon.targets | head -n 40

Repository: EvilBeaver/OneScript

Length of output: 169


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== src/oscommon.targets (top 40 lines) ==="
awk '{printf "%4d\t%s\n", NR, $0}' src/oscommon.targets | head -n 40

Repository: EvilBeaver/OneScript

Length of output: 2113


Major: oscommon.targets now uses LangVersion=default for net8.0 (C# 12) — verify downstream builds

src/oscommon.targets sets <LangVersion>default</LangVersion> with <TargetFrameworkVersion>net8.0</TargetFrameworkVersion>, which maps to C# 12 for net8.0. This will affect every project that imports oscommon.targets without overriding LangVersion.

Projects overriding LangVersion (so they won’t inherit the default):

  • src/VSCode.DebugAdapter/VSCode.DebugAdapter.csproj (7.3)
  • src/Tests/DocumenterTests/DocumenterTests.csproj (8)
  • src/OneScriptDocumenter/OneScriptDocumenter.csproj (8)
  • src/Tests/OneScript.Dynamic.Tests/OneScript.Dynamic.Tests.csproj (10.0)
  • src/Tests/OneScript.Core.Tests/OneScript.Core.Tests.csproj (10.0)
  • src/OneScript.Web.Server/OneScript.Web.Server.csproj (10.0)

All other projects importing src/oscommon.targets will compile as C# 12, including (non-exhaustive) src/ScriptEngine/ScriptEngine.csproj, src/OneScript.Core/OneScript.Core.csproj, src/OneScript.Language/OneScript.Language.csproj, src/OneScript.StandardLibrary/OneScript.StandardLibrary.csproj, and src/oscript/oscript.csproj.

Request: ensure src/1Script.sln builds successfully with the new language version (no new C# 12 warnings/errors, and no syntax/behavior regressions).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/oscommon.targets` at line 9, src/oscommon.targets sets
<LangVersion>default with <TargetFrameworkVersion>net8.0 which promotes all
importing projects to C# 12 and may break or warn in many projects; build the
solution and either fix C# 12-compatibility issues or explicitly pin LangVersion
per-project for those that must stay on an older compiler. Specifically: run a
full build of src/1Script.sln and all test projects, address any new C#12
errors/warnings (fix syntax/API uses or adjust code), and for projects that must
remain on earlier versions override <LangVersion> in their .csproj (examples
include VSCode.DebugAdapter.csproj, DocumenterTests.csproj,
OneScriptDocumenter.csproj, OneScript.Dynamic.Tests.csproj,
OneScript.Core.Tests.csproj, OneScript.Web.Server.csproj) or change
src/oscommon.targets to a conservative default; ensure all fixes remove build
failures and test regressions.

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.

1 participant