Normally referenced assemblies should not be loaded until a specific type from that assembly is used. But here is a the question:
This is a Winforms application. Although the PresentationFramework.dll & System.Xaml.dll assemblies are referenced, they should not be loaded as below code path never executes;
bool useAutoHandler = false;
if (useAutoHandler) // This is always false so below code is not executed!
{
var currentApplication = typeof(System.Windows.Application).GetProperty("Current");
if (currentApplication != null)
{
var application = currentApplication.GetValue(this, null) as System.Windows.Application;
if (application != null)
{
application.DispatcherUnhandledException += this.DispatcherUnhandledException;
}
}
}
When I query loaded assemblies with AppDomain.CurrentDomain.GetAssemblies(), I see presentation framework core & xaml being loaded. Any ideas as to why this is the case?