Thanks for the clarification. Sam
On Wednesday, 4 December 2013 14:03:59 UTC, Jb Evain wrote: > > Oh I agree it's annoying, and I agree we should have been able to > roundtrip the metadata without resolving, it's just not the case if > you want to provide a modify-able object model. > > Still, It's one of the thing I think we can optimize: if the constant > hasn't been deserialized in the object model, that is, if you didn't > access it, we should be able to bluntly copy the byte[] value from the > original module to the rewritten one. It's just not implemented. The > way it is implemented right now is correct for all cases though. > > The assembly metadata format hasn't been designed to be read/written > in a standalone fashion. There's stuff in there that requires > resolving if you want to know: > > * If a TypeRef is a value type or not without resolving. Resolving all > TypeRef to know that would be so annoying that we guess it based on > how the TypeRef is used in signatures. > * The size of an enum if it's a TypeRef, that impacts reading custom > attributes and field constants > * The Generic arity of type refs. > > For the resolver, I don't have code that uses the config file and > binding redirect elements. The easiest usually is to either subclass > or compose around the DefaultAssemblyResolver. > > Jb > > On Wed, Dec 4, 2013 at 2:36 PM, Sam S <[email protected] <javascript:>> > wrote: > > Maybe it is just me, but from my point of view a metadata reader/writer > > should be able to reconstruct the original format. If size isn't > available > > in the original format that means that in this scenario this size isn't > > required in the target format either. So, even though in the > intermediate > > in-memory format, it may be awkward to have an unresolved type, in > > principle, this shouldn't prevent reconstruction of the original as long > as > > no information from the original has been lost. > > > > Anyway, it appears that this is not possible with Cecil, so I will have > to > > write a resolver. Do you know if anyone has already written a resolver > that > > can take a .config file with codeBase and bindingRedirect elements? Or > do I > > have to implement this logic from scratch? > > > > Sam > > > > > > On Wednesday, 4 December 2013 12:58:04 UTC, Jb Evain wrote: > >> > >> That's a limitation in the assembly format. There's a few things that > >> you can't know without resolving the type. This is one of them. > >> > >> Cecil, or any metadata reader, needs to know the size to read and > >> write the constant. One could try to guess, but as any guesses, they > >> could be wrong. > >> > >> Jb > >> > >> > > -- > > -- > > -- > > 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] <javascript:>. > > For more options, visit https://groups.google.com/groups/opt_out. > -- -- -- 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.
