Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Mono.Cecil.Cil.VariableDefinitionCollection #12

Closed
KrisVandermotten opened this issue May 11, 2010 · 2 comments
Closed

Bug in Mono.Cecil.Cil.VariableDefinitionCollection #12

KrisVandermotten opened this issue May 11, 2010 · 2 comments
Labels

Comments

@KrisVandermotten
Copy link

When calling RemoveAt on Mono.Cecil.Cil.VariableDefinitionCollection, which is inherited from Collection, the variable indices are wrong.

The reason is that Collection::RemoveAt calls Collection::OnRemove before actually removing the item.
As a result, VariableDefinitionCollection::OnRemove calls ComputeIndexes() before the item is actually removed.
As a result, the call to VariableDefinitionCollection::ComputeIndexes() has no effect.

@KrisVandermotten
Copy link
Author

It looks like ParameterDefinitionCollection may have the same problem.

It looks like the Collection::Remove(T) method also causes the problem, and that a fix in both methods would be to move the call to OnRemove after the Shift/Clear/version block.

@jbevain
Copy link
Owner

jbevain commented May 11, 2010

Fixed, thanks.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants