Pre-build: Unlinked links do not load until they are needed.

I would like to create a splash screen showing the loading of an individual assembly before showing the main form.

I am doing preload:

Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); foreach (AssemblyName an in a.GetReferencedAssemblies()) { Assembly.Load(an); } 

I have two problems:

Problem 1:

Some assemblies load after preloading, even if they are not included in the links:

'x.vshost.exe' (Managed (v4.0.30319)): Loaded 'C: \ windows \ Microsoft.Net \ assembly \ GAC_MSIL \ PresentationFramework-SystemData \ v4.0_4.0.0.0bbb5a5c561934e089 \ PresentationFramework-SystemData. dll ', skipped loading characters. The module is optimized and the debugger option "Only my code" is enabled.

'x.vshost.exe' (Managed (v4.0.30319)): Loaded 'C: \ windows \ Microsoft.Net \ assembly \ GAC_MSIL \ PresentationFramework.Aero \ v4.0_4.0.0.0__31bf3856ad364e35 \ PresentationFramework.Aero. dll ', skipped loading characters. The module is optimized and the debugger option "Only my code" is enabled.

I can work around this problem by connecting the assembly to the link, but I do not want to do this, because the compiler does not force me.

Problem 2:

I am using telerik RadPadeView. On the secound page, I have an ElementHost control that contains the WPF Gantt from Telerik (the main application is WinForm). After showing the main window, I click on the second tab to see the gantt. And at this moment an additional assembly is added.

'x.exe' (Managed (v4.0.30319)): Loaded 'C: \ windows \ Microsoft.Net \ assembly \ GAC_MSIL \ PresentationFramework-SystemXmlLinq \ v4.0_4.0.0.0bbaa5c561934e089 \ PresentationFramework-SystemXmlLinq.dll', Missing Characters downloads. The module is optimized and the debugger option "Only my code" is enabled.

'x.exe' (Managed (v4.0.30319)): Loaded 'C: \ windows \ Microsoft.Net \ assembly \ GAC_MSIL \ PresentationFramework-SystemXml \ v4.0_4.0.0.0bbaa5c561934e089 \ PresentationFramework-SystemXml.dll', Missing Characters downloads. The module is optimized and the debugger option "Only my code" is enabled.

Question is how to preload all the assemblies:

  • Abstracted
  • No links (problem 1)
  • It does not load until they are needed (problem 2)
+7
reference c # winforms assemblies preload
source share
1 answer
 Assembly.Load 

All you need is to load assemblies from existing link types or along a file path. See MSDN

0
source share

All Articles