| I'm using reflection to null all the fields within a type.  When this leads to setting a primitive type to null, I get a null reference crash.  Since in the Help files it describes Null as returning a zero, null object, etc. depending on context, I thought this might be a bug.  Bug repro here: 
 
 
SuperStrict
Type TFoo
	Field theInt:Int
	Method ResetFields()
		Local selfID:TTypeId = TTypeId.ForObject(Self)
		Local fieldList:TList = selfID.EnumFields()
		For Local theField:TField = EachIn fieldList
		  theField.Set(Self, Null)
		Next
	End Method
End Type
Local foo:TFoo = New TFoo
foo.theInt = 10
foo.ResetFields()
 
 The workaround I'm using is to do a Select/Case set for all the primitives.  I tried doing this with an if statement using logical OR to string together the primitive types - that led to things bombing out on some of the more complex object types.  That may be a second bug, but I don't have time to look into it further right now.  Apologies.
 
 My system is a Dell Vostro 1500 running XP.  Core2 Duo 1.4ghz. 2 gig ram, Intel 965 integrated graphics.
 
 Thanks,
 
 Scott
 
 
 |