简体   繁体   English

XAML设计器System.TypeLoadException

[英]XAML designer System.TypeLoadException

I almost getting crazy, because getting message from XAML designer and do not know what to do 我快要疯了,因为从XAML设计器获取消息并且不知道该怎么办 在此处输入图片说明

As you can see on the line 如您所见

Could not load type 'Mocks.Libraries_Collection_Classes_Storages_0_229157595

there is a class called Storages in the Libraries.Collection namespace. Libraries.Collection名称空间中有一个称为Storages的类。 When I remove the reference Libraries.Collection from current project like: 当我从当前项目中删除引用Libraries.Collection时: 在此处输入图片说明

Then the xaml designer is working 然后,xaml设计器正在工作

在此处输入图片说明

And when I add the Libraries.Collection library again: 当我再次添加Libraries.Collection库时: 在此处输入图片说明 and open the XAML Designer, then the error appears again: 并打开XAML设计器,然后错误再次出现: 在此处输入图片说明

The class storages class looks like: 该类存储类看起来像:

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)
        {
        }
    }
}

What am I doing wrong? 我究竟做错了什么? I am using VS2015. 我正在使用VS2015。 Update I used fuslogvw.exe for record logs and the output looks as follow: 更新我将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.

The problem is the xaml designer. 问题是xaml设计器。 What should I do as next step? 我下一步应该怎么做?

After double reading your question I have edited this answer. 仔细阅读您的问题后,我已经编辑了该答案。
In an older VS versions I faced this similar exception once, but with the difference that it was at runtime. 在较旧的VS版本中,我曾经遇到过类似的异常,但是区别在于它在运行时。 In my case it end up being that a version of the assembly was already in the GAC. 就我而言,最终结果是该版本的程序集已经存在于GAC中。 For determining the cause I used Fuslogvw tool , it could be your best change for you right now to see what is going on in your box. 为了确定我使用Fuslogvw工具的原因,这可能是您现在最好的选择,以查看盒子中正在发生的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM