Skip to content

Update runtime Invoke exception handling #67457

Closed

Description

@steveharter

Description

There are some exception behavioral changes in the native Core Invoke implementation in #66357. Previously, exceptions thrown by the native code were not wrapped with TargetInvocationException and now they are. Mono should uptake these changes.

The changes are consistent with other exceptions thrown when Invoking - mainly exceptions are not wrapped when the caller's parameters are bad (wrong number of arguments, or wrong types) but are wrapped when the Target throws or does something incorrectly. This change also facilitates the design to move native code to managed by performing validation logic on the managed side and allows for other implementations of Invoke (such as future IL-emit version) to be simpler.

A breaking change issue will be created for consumers, but for now the Mono runtime should adjust to this by not catching these exceptions specially and let the normal TargetInvocationException logic wrap the exceptions.

Reproduction Steps

See the tests flags with ActiveIssue for this issue.

Expected behavior

The Mono runtime should let exceptions be re-thrown as TargetInvocationException.

Actual behavior

The Mono runtime does not re-throw as TargetInvocationException.

Regression?

Not really; semantic \ breaking change.

Known Workarounds

No response

Configuration

No response

Other information

No response

Activity

  1. ghost added
    untriagedNew issue has not been triaged by the area owner
    on Apr 1, 2022
  2. added this to the 7.0.0 milestone on Apr 5, 2022
  3. removed
    untriagedNew issue has not been triaged by the area owner
    on Apr 5, 2022
  4. SamMonoRT commented on Aug 4, 2022

    @SamMonoRT
    Member

    @steveharter @BrzVlad -- Is this work necessary to be completed for 7.0.0 or can be moved to 8.0 ?

  5. modified the milestones: 7.0.0, 8.0.0 on Aug 4, 2022
  6. ghost added
    in-prThere is an active PR which will close this issue when it is merged
    on Oct 18, 2022
  7. ghost removed
    in-prThere is an active PR which will close this issue when it is merged
    on Nov 18, 2022
  8. ghost locked as resolved and limited conversation to collaborators on Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions