Skip to content

Delegate creation with optional methods throw TargetParameterCountException when Dispatcher consumes #101400

@Aytackydln

Description

@Aytackydln

Hopefully this is the correct repository to report. This behaviour is really annoying since you cannot find where this is caused from the exception trace since this is thrown in the consuming thread.

Version Used:
NET 8

Steps to Reproduce:

Dispatcher case code sample:
https://github.com/Aytackydln/OptionalParameterTaskWpf

  1. Define a method with optional parameter
  2. Pass it to an "async" method with only method name
    Like:
    Dispatcher.BeginInvoke(MethodWithOptionalParameter)
    AsyncMethod(MethodWithOptionalParameter)
  3. Let the dispatcher consume

quick sharplab sample

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-TypeSystem-coreclrenhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions