Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

API to retrieve the entry assembly #6

Open
@bruno-garcia

Description

@bruno-garcia

The standard API to get it is:

Assembly.GetEntryAssembly()

The problem is it can return null.

We need a reliable way to get the top most entry assembly. In case it was unmanaged, then the first managed after that should work fine.

One of the approaches is to stack walk until locating the call from unmanaged code and take the assembly immediately before that. That was implemented on SharpRaven which could serve as a good starting point. It's based on an SO answer but added support to Mono too.

The goal here is to have a simple API that will make an extra effort to find the main application assembly.

Proposed API:

public class AssemblyInfo
{
    public static Assembly GetEntryAssembly();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions