C# 设计时错误,这是非常恼人的

C# 设计时错误,这是非常恼人的,c#,wpf,crystal-reports,custom-controls,C#,Wpf,Crystal Reports,Custom Controls,我在许多不同的项目中不断遇到错误,而且似乎是随机发生的。所有项目都是WPF 在设计时,它抛出crystal报告错误并拒绝向我显示设计窗口。在运行时,一切都像一个符咒。有人知道怎么解决这个问题吗 这是“设计”窗口中显示的错误: System.Reflection.Adds.UnresolvedAssemblyException Type universe cannot resolve assembly: CrystalDecisions.CrystalReports.Engine, Version

我在许多不同的项目中不断遇到错误,而且似乎是随机发生的。所有项目都是WPF

在设计时,它抛出crystal报告错误并拒绝向我显示设计窗口。在运行时,一切都像一个符咒。有人知道怎么解决这个问题吗

这是“设计”窗口中显示的错误:

System.Reflection.Adds.UnresolvedAssemblyException
Type universe cannot resolve assembly: CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304
举个例子,现在我正在尝试使用一个用户控件,所以在我看到它之前,必须关闭并重新打开窗口25-30次,这变得非常令人沮丧。当一切正常时,我触摸标签,砰的一声,它又消失了。“重新加载设计器”链接工作1/10,但在仅更改1个标记后,以这种方式修复肯定会失败

这里是用户控制代码(我知道人们会在错误发生的地方询问代码,但错误到处都会发生,所以我只给出这个代码,因为这是我正在尝试构建的新代码)


我首先想到的是,我没有使用crystal report的任何视觉控件,这个控件也与之无关

以下是CS作为证据:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Drawing;


namespace CustomTools.UserControl.ComponentSelection
{
    /// <summary>
    /// Interaction logic for UCSelections.xaml
    /// </summary>
    public partial class UCSelections : System.Windows.Controls.UserControl
    {
        public UCSelections()
        {
            InitializeComponent();
        }
    }
}
使用系统;
使用System.Collections.Generic;
使用System.Linq;
使用系统文本;
使用System.Windows;
使用System.Windows.Controls;
使用System.Windows.Data;
使用System.Windows.Documents;
使用System.Windows.Input;
使用System.Windows.Media;
使用System.Windows.Media.Imaging;
使用System.Windows.Navigation;
使用System.Windows.Shapes;
使用系统图;
命名空间CustomTools.UserControl.ComponentSelection
{
/// 
///UCSelections.xaml的交互逻辑
/// 
公共部分类:System.Windows.Controls.UserControl
{
公共选择()
{
初始化组件();
}
}
}
我曾尝试将.NET4转换为.NET4客户端配置文件,但我看到过关于这一点的帖子,可能是这样的,但他们的问题和我的完全不同

我试着编译:32位,64位和任何CPU编译。重建解决方案

有没有办法解决这个问题。顺便说一句,我不是唯一一个有这个问题的人,这里的其他几个开发人员也有同样的问题,但不需要相同的文件。一些用户控件在100%的时间内都能正常工作,但他们又一次不使用crystal。我知道使用了crystal,但有太多的控件让我知道在哪里。我还没有看到项目的全部范围

编辑#1: 我还要补充一点,当我早上开始工作时,这个问题非常罕见。我编译和运行不同的项目越多,问题就越频繁。但是重新启动电脑并没有帮助,所以看起来更巧合的是,这件事从来没有在早上发生过

编辑#2: 我打开和关闭项目几次,让错误显示出来,我设法得到它。现在我得到以下信息:

引发了类型为“MS.Internal.Validate+ValidationFailure”的异常。 在 MS.Internal.Design.DocumentModel.DocumentTreeManagers.DocumentNodeInfo.Insert(DocumentNode 项目、DocumentNode之后、DocumentNode目录)位于 MS.Internal.Design.DocumentModel.DocumentTreeManagers.ItemUpdater.ApplyDelta(INodeHost nodeHost、DeltaItemCollection delta、ModifiableDocumentTree根、, DocumentNodeDictionary oldTable,布尔值updateTable, DocumentNodeDictionary deletedItems,比较
1比较)位于
Microsoft.Windows.Design.DocumentModel.Trees.DocumentTreeManager.ApplyDelta
增量,比较
1比较) Microsoft.Windows.Design.Platform.ViewProducerBase.ApplyUpdate(Delta delta)在 Microsoft.Windows.Design.Platform.ViewProducerBase.IncrementalRebuild(DocumentTreeManager 树,损坏)在 Microsoft.Windows.Design.Platform.ViewProducerBase.UpdateView(DocumentTreeManager 树,损坏)在 Microsoft.Windows.Design.DocumentModel.ViewProducer.UpdateView(UpdateDamageArguments args)

这与上面描述的XAML/CS相同。从昨天起我就没碰过它,因为那个错误让我非常恼火。我决定做一些更有用、更少浪费时间的事情

编辑#3:

尝试了@N4TKD解决方案 我只安装了一个crystal report,所以我删除了所有对crystal report的引用,删除了我项目中的大量控件,但仍然存在这个问题。 然后我重新签出项目并验证所有项目。它们都指向.NETFramework4的
CrystalReports。13.0.2000.0

有人有同样的问题吗

顺便说一句,自上次编辑以来,我没有收到错误
MS.Internal.Validate+ValidationFailure
这是自上次编辑以来唯一的crystal报告


另外,要去掉用户控件中的
,将抛出的错误减少到接近0

尝试打开另一个visual studio实例,将调试器附加到“XdescProc”,并将调试器设置为在抛出任何异常时中断


该过程负责渲染设计时视图。异常(或innerexceptions)通常可以提供一些关于发生了什么的提示。

我们终于重新安装了旧版本的crystal report for VS2010,错误几乎不再显示。在过去的一周里,我只做了两三次,这比每天100-200次的改进很大

Crystal report在你的项目参考资料中吗?您连接的服务器是否安装了Crystal Report?什么“设计时错误[不是]很烦人?”:)是的,crystal在项目参考中。它并没有连接到服务器,只是生成报告,并在报告上没有连接后使用报告查看器。是的,当我不使用crystal report时,它试图运行。我确实觉得这很烦人。如果你不使用namesp,请删除引用
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Drawing;


namespace CustomTools.UserControl.ComponentSelection
{
    /// <summary>
    /// Interaction logic for UCSelections.xaml
    /// </summary>
    public partial class UCSelections : System.Windows.Controls.UserControl
    {
        public UCSelections()
        {
            InitializeComponent();
        }
    }
}