XAML设计器System.TypeLoadException

时间:2015-12-07 15:33:14

标签: c# wpf xaml

我几乎变得疯狂,因为从XAML设计师处获取消息并且不知道该怎么做 enter image description here

正如你在行上看到的那样

Could not load type 'Mocks.Libraries_Collection_Classes_Storages_0_229157595

在Libraries.Collection命名空间中有一个名为Storages的类。当我从当前项目中删除引用Libraries.Collection时: enter image description here

然后xaml设计师正在工作

enter image description here

当我再次添加Libraries.Collection库时: enter image description here 并打开XAML Designer,然后再次出现错误: enter image description here

类存储类看起来像:

using System.Collections.Generic;
using System.Collections.ObjectModel;

namespace Libraries.Collection.Classes
{
    public class Storages : ObservableCollection<Storage>
    {
        public Storages()
        {
        }

        public Storages(IEnumerable<Storage> coll) : base(coll)
        {
        }
    }
}

我做错了什么?我正在使用VS2015。 的更新 我使用fuslogvw.exe作为记录日志,输出如下:

*** Assembly Binder Log Entry  (12/8/2015 @ 8:05:42 AM) ***

The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.

Assembly manager loaded from:  C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll
Running under executable  C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\XDesProc.exe
--- A detailed error log follows. 

=== Pre-bind state information ===
LOG: DisplayName = XamlDesignerFaultInjection
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: XamlDesignerFaultInjection | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = XDesProc.exe
Calling assembly : Microsoft.VisualStudio.DesignTools.Utility, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\XDesProc.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.EXE.
LOG: Attempting download of new URL file:///C:/Program Files (x86)/Microsoft Visual Studio 14.0/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
LOG: All probing URLs attempted and failed.

问题在于xaml设计师。下一步该怎么做?

1 个答案:

答案 0 :(得分:0)

在仔细阅读你的问题后,我编辑了这个答案。
在较旧的VS版本中,我曾经遇到过类似的异常,但不同之处在于它在运行时。在我的情况下,它最终是一个版本的程序集已经在GAC中。为了确定我使用Fuslogvw tool的原因,现在可能是您最好的改变,看看你的盒子里发生了什么。