Unable to preview axaml usercontrol due to invalid markup error #653
Replies: 3 comments 3 replies
|
The error message is:
|
|
Looking at the installed NuGet Packages and at the dependent frameworks for each loaded project in my solution I can find no references to Avalonia 11. I did upgrade from Avalonia 11 a few weeks ago. This was before the offending usercontrol was even created. Other usercontrols are also affected in the same way, even newly created and still empty axaml files. The most recent change to my development environment was to install the VS 2026 August Feature Update which was installed last week and is now at version 18.9.2. Let me know if this is re-creatable or if I can provide any additional info. Thanks! Rick B |
|
I did take VS 2026 back to version 18.9.1, and I still had the issue. However, it is possible that the problem started in 18.9.1 and I never actually installed that version. |
Uh oh!
There was an error while loading. Please reload this page.
I am using Avalonia 12.0.5 and AvaloniaVS 12.2.2.0. I have been working on a UserControl (View). The situation is that the application builds and runs in the debugger and I am able to use the problematic view. However previewing the page in VS2026 fails with the invalid markup error message.
The top level xml element is a grid. Even if I delete all the child elements of the grid I still get the Invalid Markup error. Looking at the Avalonia Diagnostics in the Output window, I see displayed errors, but none of them are in my code. I see errors even with minimal content on the page.
Below is the content from the Avalonia Diagnostics panel after clicking on the Show Output button:
14:41:18.994 [Information] [PreviewerProcess (#27850555)] Stopping previewer process
14:41:19.010 [Information] [PreviewerProcessFactory] Resolving metadata for 'D:\My Documents\My Projects\Visual Studio 2026\Avalonia Apps\SmartShopper\SmartShopper.Desktop\SmartShopper.Desktop.csproj' (TFM=net10.0)
14:41:19.014 [Information] [ShadowCopyOutputStrategy] Shadow copy reused at 'C:\Users\Rick\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\SmartShopper.Desktop_l6ICaJHKVhkmuDd9' (8 files)
14:41:19.019 [Information] [PreviewerProcess (#27850555)] Starting previewer process for target C:\Users\Rick\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\SmartShopper.Desktop_l6ICaJHKVhkmuDd9\SmartShopper.Desktop.dll (ShadowCopy=True, NewHostApp=True)
14:41:19.022 [Information] [PreviewerProcess (#27850555)] [28444] Started previewer process for 'C:\Users\Rick\AppData\Local\AvaloniaUI\com.AvaloniaUI.Net.VisualStudio\Previewer\SmartShopper.Desktop_l6ICaJHKVhkmuDd9\SmartShopper.Desktop.dll'. Waiting for connection to be initialized.
14:41:19.006 [Information] [PreviewerProcess (#27850555)] Process exited: GenericError
14:41:19.006 [Information] [PreviewerProcess (#27850555)] Stopping previewer process
14:41:19.011 [Information] [CpsAssetsPreviewerMetadataService] Resolving extra packages [Avalonia.Headless] (Avalonia 12.0.5, net10.0)
14:41:19.086 [Information] [PreviewerProcess (#27850555)] [28444] Connection initialized
14:41:19.330 [Error] [PreviewerProcess (#27850555)] XamlX.XamlTypeSystemException: Unable to resolve type Avalonia.Data.IBinding
at XamlX.TypeSystem.XamlTypeSystemExtensions.GetType(IXamlTypeSystem sys, String type) in //src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github/src/XamlX/TypeSystem/TypeSystem.cs:line 312
at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AvaloniaXamlIlLanguage.Configure(IXamlTypeSystem typeSystem) in //src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs:line 30
at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.InitializeSre() in //src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 91
at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadGroupSreCore(IReadOnlyCollection
1 documents, RuntimeXamlLoaderConfiguration configuration) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 189 at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 261 at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 159 at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 320 at Avalonia.Markup.Xaml.AvaloniaRuntimeXamlLoader.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaRuntimeXamlLoader.cs:line 52 at AvaloniaUI.Previewer.DesignerSupport.Design.DesignWindowLoader.LoadDesignerWindow(String xaml, Assembly assembly, String xamlFileProjectPath) at AvaloniaUI.Previewer.DesignerSupport.Design.WindowSlot.ApplyXaml(String xaml, Assembly assembly, String projectPath) at AvaloniaUI.Previewer.DesignerSupport.Remote.RemoteDesignWindowManager.<>c__DisplayClass19_1.<OnTransportMessage>b__9() 14:41:20.527 [Warning] [XamlClassificationSource (#44993941)] Parsed XAML was null during classification. 14:41:20.530 [Error] [PreviewerProcess (#27850555)] XamlX.XamlTypeSystemException: Unable to resolve type Avalonia.Data.IBinding at XamlX.TypeSystem.XamlTypeSystemExtensions.GetType(IXamlTypeSystem sys, String type) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/xamlil.github/src/XamlX/TypeSystem/TypeSystem.cs:line 312 at Avalonia.Markup.Xaml.XamlIl.CompilerExtensions.AvaloniaXamlIlLanguage.Configure(IXamlTypeSystem typeSystem) in /_/src/Markup/Avalonia.Markup.Xaml.Loader/CompilerExtensions/AvaloniaXamlIlLanguage.cs:line 30 at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.InitializeSre() in /_/src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 91 at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadGroupSreCore(IReadOnlyCollection1 documents, RuntimeXamlLoaderConfiguration configuration) in //src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 189at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSreCore(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in //src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 261
at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.LoadSre(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in //src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 159
at Avalonia.Markup.Xaml.XamlIl.AvaloniaXamlIlRuntimeCompiler.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in //src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaXamlIlRuntimeCompiler.cs:line 320
at Avalonia.Markup.Xaml.AvaloniaRuntimeXamlLoader.Load(RuntimeXamlLoaderDocument document, RuntimeXamlLoaderConfiguration configuration) in //src/Markup/Avalonia.Markup.Xaml.Loader/AvaloniaRuntimeXamlLoader.cs:line 52
at AvaloniaUI.Previewer.DesignerSupport.Design.DesignWindowLoader.LoadDesignerWindow(String xaml, Assembly assembly, String xamlFileProjectPath)
at AvaloniaUI.Previewer.DesignerSupport.Design.WindowSlot.ApplyXaml(String xaml, Assembly assembly, String projectPath)
at AvaloniaUI.Previewer.DesignerSupport.Remote.RemoteDesignWindowManager.<>c__DisplayClass19_1.b__9()
The stack trace is not in my code. This is a hard repeatable error that continues to occur even after upgrading AvaloniaVS and restarting VS 2026. I hope that it is useful to someone and that perhaps there is a simple workaround.
Thanks,
Rick B.
All reactions