Skip to content
This repository was archived by the owner on May 27, 2026. It is now read-only.
This repository was archived by the owner on May 27, 2026. It is now read-only.

TextBlock Inlines error #3

Description

@silviatosi

Hi!
I am using your class BamlTranslator and I've found an issue when decompiling BAML.
If the original XAML as a TextBlock like this:


<TextBlock.Inlines>



</TextBlock.Inlines>

Where the property Inlines is used and inside there is a TextBlock collection, the function BamlTranslator.ReadText(string value) will throw a cast exception.
Unable to cast object of type 'Property' to type 'Element'

I have fixed this issue my code as following:

private void ReadText(string value)
{
// skip the function if peek returns something different from element
if (this.elementStack.Peek() is Element parent)
{
// Element parent = (Element)this.elementStack.Peek(); // the old line of code
if (this.constructorParameterTable.Contains(parent))
{
parent.Arguments.Add(value);
}
else
{
this.AddContent(parent, value);
}
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions