Using VS2017 15.9.11. When opening the designer, the designer fails before the Window is fully rendered (see below) due to an InvalidOperationException. Interestingly, after building the project while the designer is open / in view, it starts displaying correctly without exception!
If the designer fails to load my XAML in this way, it displays a single dot, instead of a detailed message as it did in the past. Even in the log, the exception details are heavily truncated. If I set DesignWidth and DesignHeight, the window is sometimes partially rendered (in white, or with some elements), but there's still no exception details. Log:
(paths to my files trimmed)
10:48:48.541 [Verbose] Finished PreviewerProcess.OnMessageAsync()
10:48:51.864 [Verbose] Started EditorFactory.CreateEditorInstance("\Sage\Views\MainWindow.xaml")
10:48:51.864 [Verbose] Started EditorFactory.GetTextBuffer("\Sage\Views\MainWindow.xaml")
10:48:51.879 [Verbose] Finished EditorFactory.GetTextBuffer("\Sage\Views\MainWindow.xaml")
10:48:51.879 [Verbose] Started EditorFactory.CreateEditorControl()
10:48:51.897 [Verbose] Finished EditorFactory.CreateEditorControl()
10:48:51.898 [Verbose] Finished EditorFactory.CreateEditorInstance("\Sage\Views\MainWindow.xaml")
10:48:51.899 [Verbose] Started DesignerPane.Initialize()
10:48:51.902 [Verbose] Started AvaloniaDesigner.Start()
10:48:51.904 [Verbose] Started AvaloniaDesigner.LoadTargetsAndStartProcessAsync()
10:48:51.904 [Verbose] Started AvaloniaDesigner.LoadTargetsAsync()
10:48:51.942 [Verbose] Finished AvaloniaDesigner.LoadTargetsAsync()
10:48:51.942 [Verbose] Started AvaloniaDesigner.StartProcessAsync()
10:48:51.942 [Verbose] 0 Started PreviewerProcess.StartAsync()
10:48:51.942 [Information] 0 Starting previewer process for '"\bin\Debug\netcoreapp2.1\Sage.dll"'
10:48:51.943 [Debug] 0 > dotnet.exe "exec --runtimeconfig \"\bin\Debug\netcoreapp2.1\Sage.runtimeconfig.json\" --depsfile \"\bin\Debug\netcoreapp2.1\Sage.deps.json\" \"\appdata\local\microsoft\visualstudio\15.0_3da171d8\extensions\ujtglfcn.mr1\Avalonia.Designer.HostApp.dll\" --transport tcp-bson://127.0.0.1:8906/ \"\bin\Debug\netcoreapp2.1\Sage.dll\""
10:48:51.944 [Information] 15744 Started previewer process for '"\bin\Debug\netcoreapp2.1\Sage.dll"'. Waiting for connection to be initialized.
10:48:51.944 [Verbose] Finished AvaloniaDesigner.Start()
10:48:51.944 [Verbose] Finished DesignerPane.Initialize()
10:48:51.942 [Verbose] Started AvaloniaDesigner.CreateCompletionMetadataAsync()
10:48:52.041 [Debug] 15744 <= "Obtaining AppBuilder instance from Sage.Program.BuildAvaloniaApp"
10:48:52.026 [Verbose] 15744 Started PreviewerProcess.ConnectionInitializedAsync()
10:48:52.091 [Debug] 15744 <= "Initializing application in design mode"
10:48:52.091 [Information] 15744 Connection initialized
10:48:52.170 [Debug] 15744 => Sending ClientSupportedPixelFormatsMessage { Formats: [Bgra8888, Rgba8888] }
10:48:52.171 [Debug] 15744 => Sending ClientRenderInfoMessage { DpiX: 96, DpiY: 96 }
10:48:52.175 [Verbose] 15744 Finished PreviewerProcess.ConnectionInitializedAsync()
10:48:52.269 [Debug] 15744 => Sending UpdateXamlMessage { Xaml: "<Window xmlns=\"https://github.c…", AssemblyPath: "\bin\De…", XamlFileProjectPath: null }
10:48:52.269 [Verbose] 15744 Finished PreviewerProcess.StartAsync()
10:48:52.329 [Debug] 15744 => Sending UpdateXamlMessage { Xaml: "<Window xmlns=\"https://github.c…", AssemblyPath: "\bin\De…", XamlFileProjectPath: null }
10:48:52.331 [Verbose] Finished AvaloniaDesigner.StartProcessAsync()
10:48:52.331 [Verbose] Finished AvaloniaDesigner.LoadTargetsAndStartProcessAsync()
10:48:52.720 [Debug] 15744 <= "Sending StartDesignerSessionMessage"
10:48:52.733 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:52.745 [Debug] 15744 <= StartDesignerSessionMessage { SessionId: "2019d67f-a6a6-433e-abc1-f6bc2b9…" }
10:48:52.745 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.011 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.020 [Debug] 15744 <= RequestViewportResizeMessage { Width: 540, Height: 34 }
10:48:53.028 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.042 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.043 [Debug] 15744 <= RequestViewportResizeMessage { Width: 540, Height: 34 }
10:48:53.043 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.044 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.044 [Debug] 15744 <= RequestViewportResizeMessage { Width: 540, Height: 34 }
10:48:53.044 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.071 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.072 [Debug] 15744 <= FrameMessage { SequenceId: 1, Format: Bgra8888, Data: "00000000000000000000000000000000... (73440 bytes)", Width: 540, Height: 34, Stride: 2160 }
10:48:53.082 [Debug] 15744 => Sending FrameReceivedMessage { SequenceId: 1 }
10:48:53.101 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.103 [Debug] 15744 <= UpdateXamlResultMessage { Error: null, Handle: null, Exception: null }
10:48:53.103 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.106 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.143 [Verbose] Finished AvaloniaDesigner.CreateCompletionMetadataAsync()
10:48:53.188 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.189 [Debug] 15744 <= UpdateXamlResultMessage { Error: "System.InvalidOperationExceptio…", Handle: null, Exception: ExceptionDetails { ExceptionType: "System.InvalidOperationException", Message: "The control already has a visua…", LineNumber: null, LinePosition: null } }
10:48:53.191 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
10:48:53.192 [Verbose] 15744 Started PreviewerProcess.OnMessageAsync()
10:48:53.192 [Debug] 15744 <= FrameMessage { SequenceId: 1, Format: Bgra8888, Data: "00000000", Width: 1, Height: 1, Stride: 4 }
10:48:53.193 [Debug] 15744 => Sending FrameReceivedMessage { SequenceId: 1 }
10:48:53.222 [Verbose] 15744 Finished PreviewerProcess.OnMessageAsync()
Unfortunately I have not been able to reliably reproduce this with another project, so here is the XAML. Hope it helps, let me know if you need some of the code and styles:
<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:vm="clr-namespace:Sage.ViewModels;assembly=Sage"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
xmlns:helpers="clr-namespace:Sage.Helpers"
Icon="resm:Sage.Assets.avalonia-logo.ico"
HasSystemDecorations="False"
ShowInTaskbar="True"
Title="Sage"
Height="34" Width="540">
<Window.Resources>
<helpers:MultiplyConverter x:Key="MultiplyConverter" />
<helpers:ThicknessConverter x:Key="ThicknessConverter" />
<helpers:AddMultiConverter x:Key="AddMultiConverter" />
<helpers:DivideMultiConverter x:Key="DivideMultiConverter" />
<helpers:MinMaxMultiConverter x:Key="MinMaxMultiConverter" />
<helpers:ConcatMultiConverter x:Key="ConcatMultiConverter" />
</Window.Resources>
<Design.DataContext>
<vm:MainWindowViewModel />
</Design.DataContext>
<i:Interaction.Behaviors>
<helpers:WindowDragBehavior />
</i:Interaction.Behaviors>
<Border Background="{DynamicResource ThemeBackgroundBrush}" BorderBrush="{DynamicResource ThemeBorderHighBrush}"
BorderThickness="{DynamicResource ThemeBorderThickness}" VerticalAlignment="Stretch">
<StackPanel Orientation="Vertical">
<Grid />
<Grid ColumnDefinitions="*,Auto" HorizontalAlignment="Stretch">
<Canvas x:Name="ScrollingHost" ClipToBounds="True" Margin="2">
<StackPanel Orientation="Horizontal">
<StackPanel.Styles>
<Style Selector="StackPanel">
<Style.Animations>
<Animation IterationCount="Infinite" Duration="0:0:3">
<KeyFrame Cue="0%">
<Setter Property="Canvas.Right"
Value="{Binding #TextBlob.Bounds.Width, Converter={StaticResource MultiplyConverter}, ConverterParameter=-1}" />
</KeyFrame>
<KeyFrame Cue="100%">
<Setter Property="Canvas.Right" Value="{Binding #TextBlobClone.Margin.Left}" />
</KeyFrame>
</Animation>
</Style.Animations>
</Style>
</StackPanel.Styles>
<TextBlock Classes="scrolling"
x:Name="TextBlob"
Text="{Binding Message}" />
<TextBlock Classes="scrolling"
x:Name="TextBlobClone"
Text="{Binding Message}">
<TextBlock.Margin>
<MultiBinding>
<MultiBinding.Converter>
<helpers:ConverterChain>
<helpers:ConverterChain.MultiValueConverter>
<helpers:MultiConverterWithParameter Converter="{StaticResource MinMaxMultiConverter}" Parameter="Max"/>
</helpers:ConverterChain.MultiValueConverter>
<helpers:ConverterWithParameter Converter="{StaticResource ThicknessConverter}" Parameter="Left"/>
</helpers:ConverterChain>
</MultiBinding.Converter>
<MultiBinding Converter="{StaticResource AddMultiConverter}" ConverterParameter="/2">
<Binding Path="#ScrollingHost.Bounds.Width"/>
<Binding Path="#TextBlob.Bounds.Width" Converter="{StaticResource MultiplyConverter}" ConverterParameter="-1"/>
</MultiBinding>
<Binding Path="MinScrollingMargin"/>
</MultiBinding>
</TextBlock.Margin>
</TextBlock>
</StackPanel>
</Canvas>
<UniformGrid Grid.Column="1" Rows="1" Columns="10" HorizontalAlignment="Left">
<Button Classes="icon prevIcon" />
<Button Classes="icon playIcon">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Click">
<ia:InvokeCommandAction Command="{Binding PlayCommand}" />
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</Button>
<Button Classes="icon nextIcon" />
<Button Classes="icon stopIcon">
<i:Interaction.Behaviors>
<ia:EventTriggerBehavior EventName="Click">
<ia:InvokeCommandAction Command="{Binding StopCommand}" />
</ia:EventTriggerBehavior>
</i:Interaction.Behaviors>
</Button>
</UniformGrid>
</Grid>
</StackPanel>
</Border>
</Window>