[Mono-list] Re: mono_verify_corlib - Checking on non-standard fields - Why?

Miguel de Icaza miguel@ximian.com
03 Jan 2003 17:36:30 -0500


Hello,

> Now, what i don't understand is
> What's the purpose of corlib verification?
> Why is corlib verification done based on such *private* fields?

This verification is a sanity-check feature.  

Some C# types are tightly bound to the runtime, for example Object,
String, Decimal, MarhsalByRefObject and so on.  

These types are tightly bound because the fields on those types are
accessed by the C runtime and by the C# code.   The C code will expect
those fields to be at specific offsets.  It will look them up and change
them, so it is important that the layout of those objects are always
kept in synchrony.

The checks are a sanity-check feature that is used to avoid the common
mistake of updating one without updating the other.  Doing so would
cause memory corruption.

Miguel