[Mono-dev] Debugging Busted CIL

Mike Welham mwelham at gmail.com
Tue Oct 4 09:01:26 EDT 2005


Hi Jim

> Looks like I can store a Managed Pointer in a local,
> but not a field :-(

If it were allowed then you could do nasty things like storing the 
address of a local variable in a field, and when the local's stack frame 
is destroyed there'd be a dangling pointer.

> Do any other ops push Managed Pointers (and then claim
> that their StackBehaviourPush is pushi?)
> 
> Can anyone see a way around this?

It depends on what exactly you're trying to do. Why do you need to store 
a managed pointer in a field?

If you're willing to sacrifice verifiability of your code, you can 
forcibly convert the managed pointer to a native int ('conv.i') and 
store that in a field. (Be careful of making the garbage collector angry 
though.)

Mike




More information about the Mono-devel-list mailing list