Torque.Core.Assert not asserting
by Christopher Perkins · in Torque X 2D · 06/06/2009 (2:15 am) · 3 replies
Ok, I've been playing around with the Platformer kit and created a Door component. Anywho, nothing is the matter there, but I am having a problem with this Assert.
Basically, Im using a hashtable to list the label of each door->a target label(with a second hash table linking the labels to actual objects). Anywho, I need to make absolutely sure that I do not label 2 doors the same, so I throw in an assert checking if the hashtable already contains the label before I throw it into the hashtable during registration. The line of code is like this:
Assert.Fatal(!_tableTargets.ContainsKey(_label.ToString()), "OMG, you named two doors: " + _label.ToString());
_tableTargets is a static hashtable
Anywho, System.Diagnostics.Debug.Assert works fine, but your assert never goes through:(. Just curious if Im using it right, or if I need to do something else to make it work? I'd rather stay consistent with the rest of the platformer kit, but if I have to stick with what works so I know its just my stupidity crashing the game as I edit levels, Ill stick with it:)
Basically, Im using a hashtable to list the label of each door->a target label(with a second hash table linking the labels to actual objects). Anywho, I need to make absolutely sure that I do not label 2 doors the same, so I throw in an assert checking if the hashtable already contains the label before I throw it into the hashtable during registration. The line of code is like this:
Assert.Fatal(!_tableTargets.ContainsKey(_label.ToString()), "OMG, you named two doors: " + _label.ToString());
_tableTargets is a static hashtable
Anywho, System.Diagnostics.Debug.Assert works fine, but your assert never goes through:(. Just curious if Im using it right, or if I need to do something else to make it work? I'd rather stay consistent with the rest of the platformer kit, but if I have to stick with what works so I know its just my stupidity crashing the game as I edit levels, Ill stick with it:)
#2
Im going to test out if the ones set up in the PSK work and whether or not this is a 3.0 thing or just me really quick...wont make this post till I do, so here it comes:
The PSK ones do not work. I tested by quickly making an actor puppet not mounted to an object. Also tested with defining a cyclic death animation, both of which should pop up a fatal assert.
2.0 It works just right. So, somethings killed Torque.Core.Assert from 2.0->3.0.
06/06/2009 (9:04 pm)
Yes. System.Diagnostics.Trace.Assert works as well, but Torque.Core.Assert.Fatal does not(nor does warn).Im going to test out if the ones set up in the PSK work and whether or not this is a 3.0 thing or just me really quick...wont make this post till I do, so here it comes:
The PSK ones do not work. I tested by quickly making an actor puppet not mounted to an object. Also tested with defining a cyclic death animation, both of which should pop up a fatal assert.
2.0 It works just right. So, somethings killed Torque.Core.Assert from 2.0->3.0.
#3
Well I know it isn't a bug or something in v3.0, because it works for me. Just need to find out what the differences are between ours so we can get yours to work also.
06/07/2009 (10:33 am)
Hmm,Well I know it isn't a bug or something in v3.0, because it works for me. Just need to find out what the differences are between ours so we can get yours to work also.
Torque Owner Lucas Shinkovich