AssemblyMetadata and ModuleMetadata's CreateFromStream apis need better documentation?
#6,163 opened on Oct 19, 2015
Description
public static AssemblyMetadata CreateFromStream(Stream peStream, bool leaveOpen = false);
public static AssemblyMetadata CreateFromStream(Stream peStream, System.Reflection.PortableExecutable.PEStreamOptions options);
In the overload that takes a bool with a default value of false, it is unclear what the api does when the bool is true. particularly, it is unclear when the stream should be disposed - can it be disposed asap versus should it be kept alive until the metadata is alive.
My inference was that if one wants to handle disposing the stream themselves (sooner or later), they are better served by using the second overload (to prefetch metadata or the entire image) than using the first. Is that correct?
Also, PEStream options has an option to leave the stream open, so why is the boolean overload required?
Similar questions arise for ModuleMetadata.CreateFromStream apis.
Perhaps there is a reason to all this, but I feel more detailed documentation will be helpful here.