Skip to content

Question - is it fine to bootstrap coreclr in DllMain? #102596

@podprad

Description

@podprad

I'm developing a legacy x32 unmanaged application that is extended by .NET Framework components.
It worked fine for ages and now it's time to upgrade from .NET Framework to .NET 8.

I wrote a C++ bootstrapper code in which I load coreclr.dll manually (by LoadLibrary("coreclr.dll")) and afterwards I call coreclr_initialize and coreclr_create_delegate.

Everything seems fine, coreclr initializes successfully and I'm able to run my .NET code.

The problem is that I'm doing the bootstrapping in DllMain() on DLL_PROCESS_ATTACH. I'm not sure if it's the right place. MSDN says that heavy operations should be avoided in DllMain. From other hand, everything seems to work fine.

Do you have any suggestions/pros/cons about bootstrapping .NET8 in DllMain?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-HostquestionAnswer questions and provide assistance, not an issue with source code or documentation.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions