我正在尝试创建一个显示程序集(所有引用的库)加载状态的初始屏幕。我使用 AppDomain.AssemblyLoad AssemblyLoadEventHandler 委托来捕获正在加载的程序集,但问题是程序初始化时未触发事件。我尝试在应用程序启动“MyApplication_Startup”中注册事件处理程序,但它不起作用。这是我的测试代码:
Partial Friend Class MyApplication
Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
AddHandler AppDomain.CurrentDomain.AssemblyLoad, AddressOf MyAssemblyLoadEventHandler
End Sub
Sub MyAssemblyLoadEventHandler(ByVal sender As Object, ByVal args As AssemblyLoadEventArgs)
Console.WriteLine(">>> ASSEMBLY LOADED: " + args.LoadedAssembly.FullName)
Console.WriteLine()
End Sub
End Class