Drew Noakes
Drew Noakes

Reputation: 310977

"Bad label content in ILGenerator" when using Reflection Emit

Some C# code using Reflection Emit is producing the following error message:

Bad label content in ILGenerator

What can cause this?

Upvotes: 2

Views: 861

Answers (1)

Drew Noakes
Drew Noakes

Reputation: 310977

I saw this error in some code that called DefineLabel but never called MarkLabel, yet tried to jump to the label.

Make sure to mark any defined labels that are used.

Upvotes: 7

Related Questions