Skip to content

Add regression test: #16154, task CE with IQueryable filters no longer throws VerificationException#19530

Merged
T-Gro merged 3 commits intomainfrom
regression-test/issue16154-75bc3271f0f7f428
Apr 10, 2026
Merged

Add regression test: #16154, task CE with IQueryable filters no longer throws VerificationException#19530
T-Gro merged 3 commits intomainfrom
regression-test/issue16154-75bc3271f0f7f428

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

Fixes #16154

Adds a regression test verifying that a task computation expression using IQueryable<T> filter functions (with return Some filter inside a conditional) no longer throws a VerificationException at runtime. The root cause was an upcast to obj inside the task state machine that broke IL verification; this is now fixed.

Test added: Language.StateMachineTestsIssue 16154 - task CE with IQueryable filter functions should compile and run without VerificationException

Generated by Repo Assist ·

To install this agentic workflow, run

gh aw add githubnext/agentics/workflows/repo-assist.md@9135cdfde26838a01779aa966628308404ec1f02

… throws VerificationException

Fixes #16154

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions bot requested a review from a team as a code owner March 31, 2026 13:29
@github-actions github-actions bot added AI-Issue-Regression-PR PR adding regression test for a closed issue NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes labels Mar 31, 2026
@github-actions github-actions bot requested review from T-Gro and abonie March 31, 2026 13:29
@github-actions
Copy link
Copy Markdown
Contributor Author

🤖 This is an automated response from Regression PR Shepherd.

This regression test proves the bug in #16154 still exists on Desktop .NET Framework. Closing this PR is recommended.

The bug: When a task { } computation expression contains branches returning Some filter where filter is an IQueryable<T> -> IQueryable<T> function, the compiler infers the return type as #IQueryable -> IQueryable (with a flexible type/implicit SRTP constraint). When combining two such results, the state machine generates an implicit upcast to obj. On .NET Framework 4.8, this causes a runtime VerificationException: Method returnFilter: type argument 'System.Object' violates the constraint of type parameter 'a'. The workaround is to add explicit type annotations to force IQueryable<Shape> -> IQueryable<Shape> (no #).

The test: tests/FSharp.Compiler.ComponentTests/Language/StateMachineTests.fsIssue 16154 - task CE with IQueryable filter functions should compile and run without VerificationException. It uses compileExeAndRun |> shouldSucceed with the exact repro from the issue report.

The failure: Build WindowsNoRealsig_testDesktop and Build WindowsCompressedMetadata_Desktop Batch2 fail on .NET Framework. The Repo Assist bot that labeled this as fixed only tested on Linux/.NET 10 (CoreCLR), where the issue does not reproduce. The VerificationException is specific to the .NET Framework runtime's strict IL verification.

The AI-thinks-issue-fixed label has been removed from #16154.

cc @T-Gro @abonie

Generated by Regression PR Shepherd ·

T-Gro and others added 2 commits April 3, 2026 12:47
The VerificationException from the upcast-to-obj in the task state machine
still occurs on .NET Framework due to stricter IL verification. The test
passes on .NET Core where this is handled correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions bot commented Apr 3, 2026

⚠️ Release notes required, but author opted out

Warning

Author opted out of release notes, check is disabled for this pull request.
cc @dotnet/fsharp-team-msft

@github-project-automation github-project-automation bot moved this from New to In Progress in F# Compiler and Tooling Apr 10, 2026
@T-Gro T-Gro merged commit 0539af7 into main Apr 10, 2026
48 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in F# Compiler and Tooling Apr 10, 2026
@T-Gro T-Gro deleted the regression-test/issue16154-75bc3271f0f7f428 branch April 10, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI-Issue-Regression-PR PR adding regression test for a closed issue NO_RELEASE_NOTES Label for pull requests which signals, that user opted-out of providing release notes

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

VerificationException on runtime, due to upcast to obj inside the task state machine

1 participant