Property accessor & CallingConvention

Topics: Metadata Model, PE Writer
Apr 29, 2010 at 1:47 PM
Edited Apr 29, 2010 at 5:27 PM


if you don't use CallingConvention = CallingConvention.HasThis in a property accessor method, the assembly will build just fine, without host errors, but the run-time's type loader with throw an exception "wrong signature" on the type without giving other informations.

Reflector will open the assembly without problems. You can detect you forgot to set CallingConvention appropriately because the accessor method doesn't show the "instance" flag when disassembled as IL.

This won't fix my problem but I thought it was worth mentioning.