Okay, I actually figured out what was happening. The table that contains the metadata tokens of each element was incorrect, and I had to write the assembly to file and then read it again to get the correct table. I'd still like to know about the process, and if there is a better way to refresh the lookup table.
Also, I can't seem to look up properties by their metadata. It always returns null. On Monday, September 7, 2015 at 9:22:21 PM UTC+3, Greg Rosenbaum wrote: > > I'm using PEVerify to check the assembly I generate using Cecil is > correct. Sometimes, it outputs a metadata token without an identifier to go > with it. I want to add identifiers to the output by regex replace and > looking up the identifiers in Cecil (by using the same AssemblyDefinition > that I wrote to file). The problem is that when I use > assembly.MainModule.LookupToken(new > MetadataToken(*the token uint I got from PEVerify*)) to find the member > with that token, I don't get the right member, or I get nothing. So I > thought PEVerify somehow gives me the wrong token, but when I open the > assembly using ILSpy, ildasm, or a similar tool, I see that it's the right > metadata token for that member after all. > > What am I doing wrong? > -- -- -- 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/d/optout.
