Skip to content

Resolve Event Extensions Issue With Open Generics #309

Description

@JasonBock

Open generics will be supported in 8.1.0 (issue #287) . However, there's a problem when the target type is generic, an open generic is requested, and the mock type has events. The extension methods generated need to be created in a static class that is also a top-level class, which is why these extension methods are generated in a separate class. However, with open generics, this presents a problem because the type parameters need to be specified, but there's no obvious way to do this.

Therefore, the extension methods are not generated in this scenario. Users can still use AddRaiseEvent(). However, it would be desirable to find a way to remove this limitation. It is possible that if the "extensions" feature was added in C#, it might make this possible, but there is no known delivery date of this feature (and it may never show up).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions