Page 1 of 1

[SOLVED] TryParse is not a function

Posted: Wed Dec 27, 2017 1:21 pm
by thatrickguy
Using the updated beta 13 release 2.

CSharpXamlForHtml5.js?201712271432:14728 Uncaught TypeError: $T06(...).TryParse is not a function
at Object.TypeFromStringConverters_ConvertByteFromString (CSharpXamlForHtml5.js?201712271432:14728)
at Delegate_Invoke (JSIL.Core.js?201712271432:9346)
at Object.TypeFromStringConverters_ConvertFromInvariantString (CSharpXamlForHtml5.js?201712271432:14755)
at Calculator1_MainPage.MainPage_InitializeComponent (Calculator1.js?201712271432:661)
at Calculator1_MainPage.MainPage__ctor (Calculator1.js?201712271432:380)
at Calculator1_MainPage (Calculator1.MainPage:17)
at Calculator1_App.App__ctor (Calculator1.js?201712271432:135)
at Calculator1_App (Calculator1.App:17)
at runMain (index.html:32)
at browserFinishedLoadingCallback (JSIL.Browser.js?201712271432:1138)

thrown by:
function TypeFromStringConverters_ConvertByteFromString (str) {
var b = new JSIL.BoxedVariable(0);
if (!$T06()['TryParse'](str, /* ref */ b)) {
throw $S01().Construct(("Xaml exception: cannot convert \"" + str + "\" to byte. To fix the issue, please locate the error by looking for the first XAML file in the Stack Trace."));
}
return b.get();
};


Occurs when I have a rectangle with a set width, no height specified, in a stack panel that is stretched vertically, only if I specify the fill brush as a child element. For example, this code throws the above error. But if I comment out all of the Rectangle.Fill children and put Fill="red" as an attribute of the Rectangle definition, it works fine. The .Fill child works fine on rectangles that are not in the stack panel, so it's a bit of an oddity.

Code: Select all

       <StackPanel Grid.Row="1" Grid.Column="0" Orientation="Horizontal" VerticalAlignment="Stretch">
                <Rectangle Width="5" Margin="15 0 0 0">
                    <Rectangle.Fill>
                        <SolidColorBrush>
                            <SolidColorBrush.Color>
                                <Color R="140" G="80" B="80" A="255"></Color>
                            </SolidColorBrush.Color>
                        </SolidColorBrush>
                    </Rectangle.Fill>
                </Rectangle>
                <Rectangle Width="95">
                   <!--<Rectangle.Fill>
                        <SolidColorBrush>
                            <SolidColorBrush.Color>
                                <Color R="80" G="0" B="0" A="255"></Color>
                            </SolidColorBrush.Color>
                        </SolidColorBrush>
                    </Rectangle.Fill>-->
                </Rectangle>
                <Rectangle Width="5" Margin="0 0 15 0">
                    <!--<Rectangle.Fill>
                        <SolidColorBrush>
                            <SolidColorBrush.Color>
                                <Color R="140" G="80" B="80" A="255"></Color>
                            </SolidColorBrush.Color>
                        </SolidColorBrush>
                    </Rectangle.Fill>-->
                </Rectangle>
            </StackPanel>


Thanks,
-Rick

Re: TryParse is not a function

Posted: Wed Dec 27, 2017 2:20 pm
by thatrickguy
I was able to get around this by defining the color as a hex value inline rather than as a child.

Thanks,
-Rick

Re: TryParse is not a function

Posted: Thu Dec 28, 2017 1:48 am
by JS-Support @Userware
Thanks Rick. We are going to fix this issue asap.

Regards
JS-Support

Re: TryParse is not a function

Posted: Fri Jan 12, 2018 10:34 am
by JS-Support @Userware
Hi,

This issue has been fixed in v1.0 Beta 13.2, which you can download from:

http://forums.cshtml5.com/viewforum.php?f=6

Thanks.
Regards,
JS-Support