dotnet/roslyn

AssemblyMetadata and ModuleMetadata's CreateFromStream apis need better documentation?

Open

#6 163 ouverte le 19 oct. 2015

Voir sur GitHub
 (0 commentaires) (0 réactions) (0 assignés)C# (4 257 forks)batch import
Area-CompilersDocumentationhelp wanted

Métriques du dépôt

Stars
 (20 414 stars)
Métriques de merge PR
 (Merge moyen 6j 17h) (256 PRs mergées en 30 j)

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.

Guide contributeur