Skip to content

Add a way for the extensions hook to know what assembly it hooks to #5116

@nohwnd

Description

@nohwnd

Summary

Automatic extension registration via hook is limited does not tell the extension into which dll it registers.

This forces mstest to call GetEntryAssembly which is null in native aot.

public static void AddExtensions(ITestApplicationBuilder testApplicationBuilder, string[] arguments) => 
    testApplicationBuilder.AddMSTest(() => [Assembly.GetEntryAssembly()!]);

Look for a way to provide the hooking binary to the hook, so it can use it in a fashion similar to Assembly.GetEntryAssembly(), but without it being null in native aot.

This is also an api that is used by all extensions so it is possibly hard to change.

Background and Motivation

Proposed Feature

Alternative Designs

Similar issue and the aot reasoning is mentioned in #4312 but providing arbitrary assemblies externall is not a goal of this change. Instead the api should just answer the question:

I am installing as extension into a dll, what is that dll?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: MTPBelongs to the Microsoft.Testing.Platform core libraryNeeds: DesignNeeds research and proposal for how the feature will be implemented.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions