While working on my Small Visual Basic, I discovered a bug in the Microsoft.SmallBasic.Library.Primitive class.
When I call Primitive.IsArray on a variable that has a numeric value, it reserts its value to null. Tracing this bug, I found that IsArray calls ConstructArrayMap(), which initializes the _arrayMap:
_arrayMap = new Dictionary<Primitive, Primitive>(PrimitiveComparer.Instance);
before calling AsStringchar[] source = AsString.ToCharArray();
Un the AsString if _arrayMap is not null, the primative value is set to the string representaion of the array which is null:
if (_arrayMap != null)
{
StringBuilder stringBuilder = new StringBuilder();
foreach (KeyValuePair<Primitive, Primitive> item in _arrayMap)
{
stringBuilder.AppendFormat("{0}={1};", Escape(item.Key), Escape(item.Value));
}
_primitive = stringBuilder.ToString();
}
While working on my Small Visual Basic, I discovered a bug in the
Microsoft.SmallBasic.Library.Primitive
class. When I call Primitive.IsArray on a variable that has a numeric value, it reserts its value to null. Tracing this bug, I found that IsArray callsConstructArrayMap()
, which initializes the _arrayMap:_arrayMap = new Dictionary<Primitive, Primitive>(PrimitiveComparer.Instance);
before callingAsString
char[] source = AsString.ToCharArray();
Un theAsString
if_arrayMap
is not null, the primative value is set to the string representaion of the array which is null: