Visual studio 使用.editorconfig抑制xaml中的错误

Visual studio 使用.editorconfig抑制xaml中的错误,visual-studio,xaml,xamarin,error-suppression,Visual Studio,Xaml,Xamarin,Error Suppression,我有以下XAML。它是(代码编译和运行很好),但是VS给了我一个错误:“XLS0505类型‘FontImageSource’像标记扩展一样使用,但不是从MarkupExtension派生的” 如何在.editorconfig中抑制它?尝试了此dotnet\u diagnostic.XLS0505.severity=none,但无效。在XAML中,有一种特殊语法,允许代码执行其他规则并间接设置其他对象。看 因此,在您的情况下,您可以设置FontImageSource,如下所示 <Imag

我有以下XAML。它是(代码编译和运行很好),但是VS给了我一个错误:“XLS0505类型‘FontImageSource’像标记扩展一样使用,但不是从MarkupExtension派生的”



如何在
.editorconfig
中抑制它?尝试了此
dotnet\u diagnostic.XLS0505.severity=none
,但无效。

在XAML中,有一种特殊语法,允许代码执行其他规则并间接设置其他对象。看

因此,在您的情况下,您可以设置FontImageSource,如下所示

<Image >
    <Image.Source>
        <FontImageSource
        FontFamily="{DynamicResource MaterialFontFamily}"
        Glyph="{Binding xxx}"
        Size="44"
        Color="{DynamicResource PrimaryColor}"/>
    </Image.Source>
    
</Image>

这就是我使用is作为标记扩展的要点。Xamarin组织的成员建议并确认错误是无效的:同样,xaml工作正常。问题是,如何抑制此无效异常,而不是如何编写xaml以避免发生此异常。