例外:使用Microsoft LightSwitch Visual Studio 2012 RC错误HRESULT E_FAIL

时间:2012-06-13 13:35:58

标签: silverlight visual-studio-lightswitch visual-studio-2012 hresult

我最近安装了Visual Studio 2012 RC以及VS 2012 SDK和LightSwitch可扩展性工具包。

这是我的Client.Design中的XAML代码 - > TControl.XAML文件

<UserControl x:Class="CustomControls.Presentation.Controls.TControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:framework="clr-namespace:Microsoft.LightSwitch.Presentation.Framework;assembly=Microsoft.LightSwitch.Client">   
    <Grid Width="Auto">
        <Grid.RowDefinitions>
            <RowDefinition Height="100"></RowDefinition>
            <RowDefinition Height="40"></RowDefinition>
        </Grid.RowDefinitions>
        <framework:ContentItemPresenter ContentItem="{Binding ChildItems[0]}" Grid.Row="0" Margin="3" />
        <framework:ContentItemPresenter ContentItem="{Binding ChildItems[1]}" Grid.Row="0" Margin="3" />
    </Grid>
</UserControl>

我无法在设计器上看到此XAML的输出。相反,我在设计师领域看到了这个错误消息:

Exception: Error HRESULT E_FAIL has been returned from a call to a COM component.
Stacktrace: 
    at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
    at MS.Internal.XcpImports.Collection_InsertValue[T](PresentationFrameworkCollection`1 collection, UInt32 index, CValue value)
    at MS.Internal.XcpImports.Collection_InsertDependencyObject[T](PresentationFrameworkCollection`1 collection, UInt32 index, DependencyObject value)
    at System.Windows.PresentationFrameworkCollection`1.InsertDependencyObject(Int32 index, DependencyObject value)
    at System.Windows.Controls.UIElementCollection.InsertInternal(Int32 index, UIElement value)

我强烈怀疑这与此处涉及的命名空间和Silverlight版本有关。我的项目设置为使用Silverlight版本5。

一个快速的谷歌搜索和'Stackoverflowing'确实揭示了一些关于这个错误的一般信息,但没有太多帮助。

任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

你已经明确了哪个版本的LS RC&amp;您安装的2012 SDK,但是您安装了哪个版本的可扩展性套件?我知道有一个是针对Beta发布的,我不确定是否有另一个是专门为LS V2 RC发布的。

答案 1 :(得分:0)

要在VS2013终极版中修复此问题,我必须关注帖子http://rathodkrunal.blogspot.com/2011/11/visual-studio-2010-error-hresult-efail.html

其中只讨论清理Visual Studio的ItemTemplateCache并使用/ setup标志运行vs。

如果链接断开或者在此处不可用,那么缓存曾用于较旧的VS:

  

您可以在“Program Files \ Microsoft Visual”中删除项目缓存   Studio 10.0 \ Common7 \ IDE \ ProjectTemplatesCache“,然后运行”devenv   / setup“再次构建缓存以查看它是否有帮助。