Wpf 当项目代码落后时,Xaml设计器引发异常

Wpf 当项目代码落后时,Xaml设计器引发异常,wpf,xaml,Wpf,Xaml,当我尝试加载视图(即MainWindow.xaml)时,会发生未处理的异常。只有当项目代码在后台运行时,才会发生这种情况。否则就可以了。请帮助。以下是异常详细信息 截图如下: System.ArgumentNullException 值不能为null。 参数名称:remoteValues 位于Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalNotifyingEnumerable2..ctor(

当我尝试加载视图(即MainWindow.xaml)时,会发生未处理的异常。只有当项目代码在后台运行时,才会发生这种情况。否则就可以了。请帮助。以下是异常详细信息

截图如下:

System.ArgumentNullException 值不能为null。 参数名称:remoteValues 位于Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalNotifyingEnumerable
2..ctor(IRemoteNotifyingEnumerable
1 remoteValues,Func`2转换器) 在Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Remoting.LocalDesignerView.Microsoft.VisualStudio.DesignTools.DesignerContract.IDesignerView.get_RelatedDocumentPath()中 位于Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerInfo(CancellationToken cancelToken)

我尝试单击“单击此处以禁用项目代码并重新加载设计器”。当我这样做的时候,它就起作用了。但是当我启用项目代码时,同样的异常也会出现

Mainwindow.xaml:

<Window x:Class="QCFilterSaver.View.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        Style="{DynamicResource MetroStyle}"
        xmlns:view="clr-namespace:QCFilterSaver.View"
        mc:Ignorable="d"
        Title="QC Filter Saver" Height="520" Width="1200" WindowStartupLocation="CenterScreen">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Themes/ExpressionDark.xaml"/>
                <ResourceDictionary Source="/Themes/MetroDark.MSControls.Core.Implicit.xaml"/>
                <ResourceDictionary Source="/Themes/MetroDark.MSControls.Toolkit.Implicit.xaml"/>
                <ResourceDictionary Source="/Controls\DataGridStyleDictionary.xaml"/>
                <ResourceDictionary Source="/MainDataTemplates.xaml"/>
                <ResourceDictionary Source="/Controls/Styles/LoadingArcsRing.xaml"/>
                <ResourceDictionary Source="/Controls/Styles/LoadingThreeDots.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>

    <Grid>
        <view:FSView x:Name="FSView" HorizontalContentAlignment="Stretch"/>
    </Grid>
</Window>


FSView.xaml:

<UserControl x:Class="QCFilterSaver.View.FSView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:QCFilterSaver.ViewModels"
             mc:Ignorable="d" 
             d:DesignHeight="520" d:DesignWidth="1200">

    <UserControl.DataContext>
        <local:FSViewModel/>
    </UserControl.DataContext>  
    <UserControl.Resources>
        <Style TargetType="{x:Type TextBox}">
            <Style.Triggers>
                <Trigger Property="IsMouseOver" Value="True">
                    <Setter Property="BorderBrush" Value="#a70711"></Setter>
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>  
    <Grid>
<!--my properties and bindings here-->
</Grid>
</UserControl>

FSView.xaml:

设计器应该毫无例外地自动加载,但它只是不加载。

根据这一点,它应该在visual studio 2017中修复。15.0错误仍然存在于最新的VS版本中。根据这一点,它应该在visual studio 2017中修复。15.0错误仍然存在于最新的VS版本中