Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextBlock Inlines error #3

Open
silviatosi opened this issue Sep 5, 2019 · 0 comments
Open

TextBlock Inlines error #3

silviatosi opened this issue Sep 5, 2019 · 0 comments

Comments

@silviatosi
Copy link

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);
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant