每当我将任何控件添加到Microsoft.Phone命名空间(Pivot,Panorama等)中的Windows Phone 8应用程序时,XAML设计器都会抛出:
错误HRESULT E_FAIL已从调用COM组件返回。
堆栈跟踪似乎不同,这是在文档大纲中选择Panorama后的跟踪:
at Microsoft.Phone.Controls.Design.PanoramaItemAdorner.Activate(ModelItem item)
at Microsoft.Windows.Design.Interaction.AdornerProvider.InvokeActivate(EditingContext context, ModelItem item)
at MS.Internal.Features.AdornerProviderFeatureConnector.FeatureProvidersAdded(ModelItem item, IEnumerable`1 extensions)
at Microsoft.Windows.Design.Policies.PolicyDrivenFeatureConnector`1.OnPolicyItemsChanged(Object sender, PolicyItemsChangedEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at Microsoft.Windows.Design.Policies.ItemPolicy.OnPolicyItemsChanged(PolicyItemsChangedEventArgs e)
at Microsoft.Windows.Design.Policies.SelectionPolicy.OnSelectionChanged(Selection newSelection)
at Microsoft.Windows.Design.ContextItemManager.SubscribeProxy`1.SubscribeContext(ContextItem item)
at Microsoft.Windows.Design.SubscribeContextCallback.Invoke(ContextItem item)
at Microsoft.Windows.Design.EditingContext.DefaultContextItemManager.OnItemChanged(ContextItem item)
at Microsoft.Windows.Design.EditingContext.DefaultContextItemManager.SetValue(ContextItem value)
at Microsoft.Expression.DesignSurface.ViewModel.Extensibility.ExtensibilityManager.SetSelection(Selection selection)
at Microsoft.Expression.DesignSurface.ViewModel.Extensibility.ExtensibilityManager.OnViewModelEarlySceneUpdatePhase(Object sender, SceneUpdatePhaseEventArgs args)
at Microsoft.Expression.DesignSurface.ViewModel.SceneUpdatePhaseEventHandler.Invoke(Object sender, SceneUpdatePhaseEventArgs args)
at Microsoft.Expression.DesignSurface.ViewModel.SceneViewModel.FireEarlySceneUpdatePhase(SceneUpdatePhaseEventArgs args)
at Microsoft.Expression.DesignSurface.Pipeline.SceneViewUpdateScheduleTask.UpdateEarly()
at Microsoft.Expression.Utility.Scheduler.ScheduleTask.Update()
at Microsoft.Expression.Utility.Scheduler.SchedulingService.DispatchTasksAtPriority(DispatcherPriority priority)
at Microsoft.Expression.Utility.Scheduler.SchedulingService.DispatcherToken.Dispatch(Object arg)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
如果文件加载了控件,则堆栈跟踪如下所示:
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
相同的.xaml文件在Blend中工作得很好,设计师在删除控件后立即重新开始工作。
我尝试卸载/修复Windows Phone 8 SDK,Visual Studio以及Silverlight SDK和运行时。
还有其他想法吗?
答案 0 :(得分:3)
我遇到了同样的问题,并尝试了很多论坛上讨论的每个答案。
最后我删除了我的'解决方案'文件(.sln),而不是项目,然后将我的所有项目添加回我的新解决方案。
使用:VisualStudio Express 2012
步骤:
现在效果很好......希望有所帮助。
答案 1 :(得分:0)
可能有两种想法可能不相关......
答案 2 :(得分:0)
当我添加引用System.Windows.Controls.DataVisualization.Toolkit时,我遇到了同样的问题,我收到了这个错误。之后,我从路径中添加了参考System.Windows.Controls.Toolkit:C:\ Program Files \ Microsoft SDKs \ Silverlight \ v3.0 \ Libraries \ Client或C:\ Program Files(x86)\ Microsoft SDKs \ Silverlight \ v3.0 \ Libraries \ Client和VS工作正常。 也许它会帮助你。