How to know when AppDomain starts?

How and Programmatically to find when the ASP.NET workflow and application domain started? but more general.

How to find out the start time for AppDomain?

I tried something like this:

private readonly static DateTime _appDomainStarted = DateTime.UtcNow; public static DateTime GetApplicationDomainStartedTimeUTC() { return _appDomainStarted; } 

But a static file is created only after it was a link once at runtime, so it does not work.

Perhaps there is a way to ensure that this code runs automatically when the assembly loads?

+4
source share

Source: https://habr.com/ru/post/1440531/


All Articles