通过Avalonia C# Project模板创建的新项目,只要修改了App.axaml文件就提示下面这个错误:
Internal compiler error while transforming node XamlX.Ast.XamlAstObjectNode:
XamlX.XamlTypeSystemException: Unable to resolve type Avalonia.Data.RelativeSource
at XamlX.TypeSystem.XamlTypeSystemExtensions.GetType(IXamlTypeSystem sys, String type)
at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers.AvaloniaXamlIlWellKnownTypes..ctor(TransformerConfiguration cfg)
at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers.AvaloniaXamlIlWellKnownTypesExtensions.GetAvaloniaTypes(AstTransformationContext ctx)
at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers.XDataTypeTransformer.Transform(AstTransformationContext context, IXamlAstNode node)
at XamlX.Transform.AstTransformationContext.Visitor.Visit(IXamlAstNode node) Line 1, position 2. AvaloniaApplication2 C:\Users\36388\source\repos\AvaloniaApplication2\AvaloniaApplication2\Views\MainView.axaml 1
通过Avalonia C# Project模板创建的新项目,只要修改了App.axaml文件就提示下面这个错误: Internal compiler error while transforming node XamlX.Ast.XamlAstObjectNode: XamlX.XamlTypeSystemException: Unable to resolve type Avalonia.Data.RelativeSource at XamlX.TypeSystem.XamlTypeSystemExtensions.GetType(IXamlTypeSystem sys, String type) at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers.AvaloniaXamlIlWellKnownTypes..ctor(TransformerConfiguration cfg) at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers.AvaloniaXamlIlWellKnownTypesExtensions.GetAvaloniaTypes(AstTransformationContext ctx) at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.Transformers.XDataTypeTransformer.Transform(AstTransformationContext context, IXamlAstNode node) at XamlX.Transform.AstTransformationContext.Visitor.Visit(IXamlAstNode node) Line 1, position 2. AvaloniaApplication2 C:\Users\36388\source\repos\AvaloniaApplication2\AvaloniaApplication2\Views\MainView.axaml 1
但是build是成功的,也可以成功运行,就是无法预览
我的环境如下: VS2022 Avalonia 11.0.2 Semi.Avalonia 11.0.1 .NET 7.0