Skip to content

XML declaration better error reporting for malformed attribute content #520

@PanayotCankov

Description

@PanayotCankov

The following crashes my app in iOS:

  <GridLayout rows="* auto auto auto 2*">
    <TextField row="1" text="{{ username }}" autocorrect="false" autocapitalizationType="none" hint="email" keyboardType="email" cssClass="firstTextField" />
    <TextField row="2" text="{{ password }}" secure="true" hint="password" />
    <Button row="3" text="{{ resources.login }}" tap="{{ login }}" cssClass="primaryButton" />
    <ActivityIndicator rowSpan="5" busy="{{ isLoading }}" />
  </GridLayout>

With a native exception (crash):

*** Terminating app due to uncaught exception 'CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [187.5 nan]'
*** First throw call stack:
(
    0   CoreFoundation                      0x02d77746 __exceptionPreprocess + 182
    1   libobjc.A.dylib                     0x0225ba97 objc_exception_throw + 44
...

I would expect:

  1. The * auto auto auto 2* to be perfectly acceptable, since writing comma separators even in XAML was not a must, they add no meaning and are tedious to write.
  2. If the * auto auto auto 2* must contain commas like *, auto, auto, auto, 2*, I would expect the app to warn during parsing the XML with source line and column, indicating the element and attribute that failed to parse.
  3. I would prefer warning with error details and malicious layout, before JavaScript exception with error details, before crash with native stack.

This following works like a charm:

  <GridLayout rows="*, auto, auto, auto, 2*">
    <TextField row="1" text="{{ username }}" autocorrect="false" autocapitalizationType="none" hint="email" keyboardType="email" cssClass="firstTextField" />
    <TextField row="2" text="{{ password }}" secure="true" hint="password" />
    <Button row="3" text="{{ resources.login }}" tap="{{ login }}" cssClass="primaryButton" />
    <ActivityIndicator rowSpan="5" busy="{{ isLoading }}" />
  </GridLayout>

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions