【问题标题】:E_UNEXPECTED UWP Catastrophic FailureE_UNEXPECTED UWP 灾难性故障
【发布时间】:2016-03-21 11:02:22
【问题描述】:

我得到以下信息:

灾难性故障(HRESULT 异常:0x8000FFFF (E_UNEXPECTED))

当 ListView 属性在 Visual State 中设置为 Null 时。没道理,为什么VS和Blend会抱怨?

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

编辑
类似的问题:

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

其中 NumberButtonBox 被定义为

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

错误显示 在 setter 上使用 {x:Null} 的值,而不是在另一行。更改 Setter 行的顺序没有效果。

以这种方式将属性设置为 Null 是否是清除该值的正确方法?在运行时它确实有效,只是编辑器对此有问题。

【问题讨论】:

  • “灾难性故障”只是对 UWP 中错误报告质量的描述,它对诊断任何事情都毫无用处。 stackoverflow.com/help/mcve
  • 但至少它发生在特定情况下:&lt;Setter&gt; 的值为{x:Null}
  • 代码中的列表视图是什么?请发布更多代码..

标签: crash visual-studio-2015 uwp blend


【解决方案1】:

在设计时设置 null 而不会崩溃的唯一替代方法是这样(如 this similar question 中所述)

示例:

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

代替:

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

【讨论】:

  • 空集合可以用于集合类型的属性,但不能用于其他属性。请注意,只有设计器会报告崩溃,运行时它会按预期工作。
  • Mmh 对于非集合类型,我认为唯一的方法是使用转换器而不是 x:Null 绑定。检查这个:stackoverflow.com/questions/356194/…
猜你喜欢
  • 1970-01-01
  • 2014-07-18
  • 2016-07-06
  • 2010-12-04
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多