Skip to content

Avoid checked-build assertion for open Nullable assignability - #135208

Merged
jkotas merged 6 commits into
mainfrom
copilot/fix-assert-failure-in-casthelpers
Oct 6, 2026
Merged

jkotas merged 6 commits into
mainfrom
copilot/fix-assert-failure-in-casthelpers

Conversation

Copilot AI commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Open Nullable<> has a type descriptor as its generic argument, but nullable casting treated that argument as a MethodTable*. Consequently, a legal IsAssignableFrom call asserts on checked builds.

  • Runtime: Represent nullable generic arguments as TypeHandle and read them through a managed MethodTable.NullableType property. Keep InstantiationArg0 only for debug verification when the argument is a method table.
  • Regression coverage: Add open-Nullable<> assignability cases alongside the existing nullable cases.

@azure-pipelines

azure-pipelines Bot commented Oct 5, 2026 •

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

Copilot AI and others added 2 commits October 5, 2026 12:43
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix assert failure in CastHelpers.IsNullableForType Avoid checked-build assertion for open Nullable&lt;&gt; assignability Oct 5, 2026
Copilot AI requested a review from jkotas October 5, 2026 12:48
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @steveisok, @dotnet/area-system-reflection
See info in area-owners.md if you want to be subscribed.

Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
Co-authored-by: jkotas <6668460+jkotas@users.noreply.github.com>
@jkotas jkotas changed the title Avoid checked-build assertion for open Nullable&lt;&gt; assignability Avoid checked-build assertion for open Nullable assignability Oct 5, 2026
@jkotas
jkotas marked this pull request as ready for review October 5, 2026 14:52
@jkotas
jkotas merged commit f7fcbf8 into main Oct 6, 2026
134 of 136 checks passed
@jkotas
jkotas deleted the copilot/fix-assert-failure-in-casthelpers branch October 6, 2026 04:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Assert failure in CastHelpers.IsNullableForType for an open Nullable<T>

3 participants