Skip to content

Enable CoreCLR contracts for Linux x64 by removing unconditional UNIX contract disablement - #131350

Draft
davidwrighton with Copilot wants to merge 3 commits into
mainfrom
copilot/enable-coreclr-contracts-linux-x64
Draft

Enable CoreCLR contracts for Linux x64 by removing unconditional UNIX contract disablement#131350
davidwrighton with Copilot wants to merge 3 commits into
mainfrom
copilot/enable-coreclr-contracts-linux-x64

Conversation

Copilot AI commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

CoreCLR contracts were globally disabled on UNIX, which kept Linux x64 excluded even after ambiguous contract syntax was removed in #126625. This change narrows that policy so Linux x64 CoreCLR builds can run with contracts enabled while preserving existing behavior elsewhere.

  • Build configuration change

    • Updated /home/runner/work/runtime/runtime/eng/native/configurecompiler.cmake to stop defining DISABLE_CONTRACTS for CoreCLR + Linux + AMD64.
    • Kept DISABLE_CONTRACTS in place for all other UNIX targets.
  • Scope control

    • Change is limited to compile-definition gating; no contract macro refactors and no unrelated runtime behavior changes.
  • Resulting configuration shape

if(CLR_CMAKE_TARGET_UNIX)
  if(NOT (CLR_CMAKE_RUNTIME_CORECLR AND CLR_CMAKE_TARGET_LINUX AND CLR_CMAKE_TARGET_ARCH_AMD64))
    add_definitions(-DDISABLE_CONTRACTS)
  endif()
endif()

Copilot AI review requested due to automatic review settings July 24, 2026 21:47

Copilot AI left a comment

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 24, 2026 22:30

Copilot AI left a comment

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI changed the title [WIP] Enable CoreCLR contracts on Linux x64 Enable CoreCLR contracts for Linux x64 by removing unconditional UNIX contract disablement Jul 24, 2026
Copilot AI requested a review from davidwrighton July 24, 2026 22:42
@davidwrighton

Copy link
Copy Markdown
Member

@copilot this works better than I expected. Enable contracts for Linux Arm64, and Mac Arm64 as well. In addition, this worked so well that I need you to validate that an intentionally introduced incorrect contract actually fails. Please inject such a failing contract, and test locally.

Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 27, 2026 21:56

Copilot AI left a comment

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.

Copilot was unable to review this pull request because there is no eligible user to bill. To allow Copilot reviews on bot-authored pull requests, enable direct organization billing in your organization's Copilot settings.

Copilot AI commented Jul 27, 2026

Copy link
Copy Markdown
Contributor Author

@copilot this works better than I expected. Enable contracts for Linux Arm64, and Mac Arm64 as well. In addition, this worked so well that I need you to validate that an intentionally introduced incor...

Updated in cbea1d97.

I expanded the UNIX contract-disable exception to include CoreCLR on Linux Arm64 and macOS Arm64 (in addition to Linux x64).

I also validated contract enforcement locally by temporarily injecting an invalid contract (PRECONDITION();) and rebuilding CoreCLR debug; the build failed as expected due to the bad contract usage. I then reverted that temporary injection and revalidated the normal build path.

Note

This reply was generated with GitHub Copilot.

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

Labels

area-Infrastructure-coreclr Only use for closed issues

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants