Dear ladies and sirs.
Observe the following piece of Silverlight code:
foreach (AssemblyPart ap in Deployment.Current.Parts)
{
var sri = Application.GetResourceStream(new Uri(ap.Source, UriKind.Relative));
var assembly = new AssemblyPart().Load(sri.Stream);
// Do something with the assembly.
}
It iterates over all the assemblies available to the application and does something on them. The problem with this code is that even if that something is just reading the assembly manifest, the code loads the complete assemblies into the process space.
Is it possible to optimize it somehow?
I have similar .NET code, which uses PostSharp.Core library to just read the assembly manifests, without loading the complete assemblies (Mono.Cecil does the job as well).
Thanks in advance to all the good Samaritans out there.