我正在做的预加载:
Assembly a = System.Reflection.Assembly.GetExecutingAssembly(); foreach (AssemblyName an in a.GetReferencedAssemblies()) { Assembly.Load(an); }
我有两个问题:
问题1:
某些程序集在预加载后加载,即使它们未包含在引用中:
‘x.vshost.exe’ (Managed (v4.0.30319)): Loaded ‘C:\windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemData\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemData.dll’,Skipped loading symbols. Module is optimized and the debugger option ‘Just 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 symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.
我可以通过将程序集连接到引用来解决这个问题,但我不想这样做,因为编译器不强迫我.
问题2:
我正在使用telerik RadPadeView.在secound页面上,我有一个ElementHost控件,它包含来自Telerik的WPF Gantt(主应用程序是WinForm).在显示主窗口后,我点击第二个选项卡查看甘特图.在这一点上,加载了额外的组合.
‘x.exe’ (Managed (v4.0.30319)): Loaded ‘C:\windows\Microsoft.Net\assembly\GAC_MSIL\PresentationFramework-SystemXmlLinq\v4.0_4.0.0.0__b77a5c561934e089\PresentationFramework-SystemXmlLinq.dll’,Skipped loading symbols. Module is optimized and the debugger option ‘Just 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.0__b77a5c561934e089\PresentationFramework-SystemXml.dll’,Skipped loading symbols. Module is optimized and the debugger option ‘Just My Code’ is enabled.
问题是,如何预加载所有程序集:
>参考
>未引用(问题1)
>在需要之前不加载(问题2)