phm
phm

Reputation: 1170

E_UNEXPECTED UWP Catastrophic Failure

I am getting the following:

Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))

when the ListView attribute is set to Null in the Visual State. It makes no sense, why does VS and Blend complain?

<VisualState.Setters>
     <Setter Target="listView.(Selector.IsSynchronizedWithCurrentItem)" Value="{x:Null}"/>
</VisualState.Setters>

EDIT
A similar issue:

 <VisualState.Setters>
   <Setter Target="NumberButtonBox.(RelativePanel.RightOf)" Value="{x:Null}" />
   <Setter Target="NumberButtonBox.(RelativePanel.Below)" Value="GridPlaceholder" />
</VisualState.Setters>

where NumberButtonBox is defined as

<Viewbox x:Name="NumberButtonBox" RelativePanel.RightOf="GridPlaceholder" MaxWidth="250" MaxHeight="450" MinWidth="200">

The error shows only on the setter using a value of {x:Null}, not on the other line. Changing the order of the Setter lines has no effect.

Is setting the property to Null in this way the correct way to clear this value? At runtime it does work, just the editor has issues with this.

Upvotes: 10

Views: 1675

Answers (1)

Frix33
Frix33

Reputation: 1241

The only alternative to set null without crash at design time is this (as reported in this similar question)

example:

<Style x:Key="MyList" TargetType="ListView">
    <Setter Property="Transitions" >
        <Setter.Value>
            <TransitionCollection></TransitionCollection>
        </Setter.Value>
    </Setter>
</Style>

instead of:

Style x:Key="MyList"
        TargetType="ListView">
    <Setter Property="Transitions" 
            Value="{x:Null}"/>
</Style>

Upvotes: 2

Related Questions