GenericParameterComparer throws exception #118
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GenericParameterComparer throws exception if genericParameter.Owner.MetadatToken.TokenType == TokenType.MemberRef
and index == CodedIndex.TypeOrMethodDef
this happened as I implemented a generic method (with generic parameters of its own) that belongs to a generic interface, after I made that method's declaring type generic.
It all worked after I added a line at Utilities.cs as follows:
Hey,
It doesn't look like quite correct, from a metadata point of view. In the assembly, the owner of an actual GenericParameter in the GenericParam can not be a MemberRef.
You're probably doing something that generates a wrong object model for Cecil.
Sadly Cecil doesn't verify much. If you can past some code, I can probably tell what's wrong.
Sorry to revive this old issue.
I have a similar problem with the master branch. There is no issue if I use tag 0.9.5. Somehow it is the newest nuget/master branch.
I am not sure how it happens as I am not the one who wrote the code utilizing cecil. But after a long debugging session I came down to the same conclusion as @jlamfers. All the code did was to copy a generic method and inject back into the same class under a different name. Somehow the token of this copied method became MemberRef when trying to output the changed assembly.
0.9.5.0 works, 0.9.5.4 doesn't.
Hey @awyl
Do you think you could cook-up a simple repro? That would sure help me investigate the issue.
We did change some importing stuff for generics in .4, so it's probably related. But I'd love to have a simple piece of code I could run against both versions.
I extracted the portion of from the library and put it into a separate project.
https://dl.dropboxusercontent.com/u/108285103/CecilTest.zip
I am very new to this IL stuff, and I am not sure whether it is this library or Cecil. Hope this helps.