VB.Net WinForms Application Main Form Loading with Splash Screen

I have a VB.NET WinForms application with a splash screen containing a progress bar which I can successfully update during the Load event of the Main Form (formMain). This was accomplished by reviewing the following article:

How can I determine what is occurring in my application prior to the formMain_Load() event being triggered? The splash screen is visible and active for 15 seconds prior to reaching the breakpoint at the first line of the MyBase.Load event of formMain. Afterwards, everything is as expected. What is happening during this time prior to the main form getting loaded? Any information is greatly appreciated. Thank you for your time and help.

It really depends on your application and the framework used. However in a nutshell. when your application is compiled, a PE executable is generated. This PE application contains:

An entrypoint (usually Main).

A list of dependencies as dynamic libraries (which includes MSCOREE.DLL; the .NET Common Object Runtime Execution Engine).

Additional metadata including the targeted .NET runtime version

When a user starts the application (by clicking on it, running it from a command line, etc.), the Windows loader implementation (in NTDLL.dll) takes over. The loader code is responsible for putting the executable into memory, loading any dynamic link libraries, mapping any linked libraries into a place that the executable code can reach them and updating the Import Address Table.

Once this is all completed, the loader jumps to the defined entry point. The entry point goes to mscoreee.dll which was mapped into the processes memory. MSCOREE.DLL looks at the metadata loaded from the PE executable (specifically the CLR header and targeted .NET runtime version). From that it can bind the the correct CRL version using CorBindToRuntimeEx2.

CorBindToRuntimeEx2 loads the correct .NET runtime implementation (and returns a pointer to a COM interface allowing you to invoke that .NET runtime). This code is loaded from the dlls in %WINDIR%\Microsoft.NET\Framework\{associated version number}

At this point, the MSCORREE shim uses the .NET ICLRRuntimeHost interface point to invoke the methods needed to initialize the .NET runtime, garbage collector, IL interpreter, JIT and IHostControl interfaces (that allow the .NET interpreter to talk back to the hosting process). Finally, mscoree tells the IL interpreter to start executing your compiled application's IL code.The amazing thing is that all of the above, *usually*, happens in a matter of milliseconds.

The unfortunate thing, is that you cannot have a .NET Splash Screen for the above process as it is basically an unmanaged bootstrapper process and ultimately outside of the control of .NET.

Featured Post

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should. An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.

This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg).
If you're looking for how to monitor bandwidth using netflow or packet s…