Hi,

On Sat, Mar 30, 2013 at 5:34 AM, Jonathan Pryor <[email protected]> wrote:
> On Mar 29, 2013, at 10:14 PM, Alex Rønne Petersen <[email protected]> wrote:
>> The issue is, of course, that the interpretation of the name is ambiguous.
>
> The real issue is one of semantics.
>
> Here's the scenario: You have a path to an assembly ("/Conference/Advanced, 
> Day 1, First Half/Demo Name/bin/Debug/Assembly.dll").
>
> Question: How should you get an AssemblyNameReference from the assembly?
>
> The (broken?) assumption in some parts of our code was that 
> AssemblyNameReference.Parse(path) would Do The Right Thing (for some 
> variation of "right"), but this does not in fact work ("path has commas in it 
> causes things to go kablooie").

Even if we assume that we cannot throw a path at ANR.Parse (), an
assembly name like "Foo, Bar" can still screw things up. So other than
saying "just don't feed paths to it", other rules about what an
assembly name can contain apply.

So the question is: How strict is it supposed to be?

>
> I suspect that the "proper" solution is:
>
>         AssemblyDefinition def = AssemblyDefinition.ReadAssembly (path);
>         AssemblyNameReference name = def.Name;
>
> This has the unfortunate requirement that the file needs to be read to 
> determine what the name is, which makes it hard to have a cache of 
> AssemblyNameReferences to avoid opening and reading assemblies... Meaning 
> there's no point in having a cache of AssemblyNameReference > 
> AssemblyDefinition; instead you'd want Path > AssemblyDefinition. And if two 
> different paths have the same AssemblyNameReference (e.g. double 
> reference)...that'll need to be validated/prevented.
>
>  - Jon
>
> --
> --
> --
> mono-cecil
> ---
> You received this message because you are subscribed to the Google Groups 
> "mono-cecil" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Regards,
Alex

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to