Skip to content

Primative Bug #185

@VBAndCs

Description

@VBAndCs

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 AsString
char[] 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();
		}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions