Rider fails to build XAML preview
Answered
I'm trying to create a WPF application in Rider.
This is the MainWindow.xaml contents. This project perfectly builds and renders correctly
<Window x:Class="NPFacade.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"
xmlns:local="clr-namespace:NPFacade"
mc:Ignorable="d"
WindowState="Normal"
WindowStyle="SingleBorderWindow"
WindowStartupLocation="CenterScreen"
MinHeight="600"
MinWidth="1000"
Background="White"
Title="NewsPro Facade" Height="600" Width="1000">
<WindowChrome.WindowChrome>
<WindowChrome
ResizeBorderThickness="{Binding ResizeBorderThikness}"
GlassFrameThickness="0"
CaptionHeight="62"
CornerRadius="0"
/>
</WindowChrome.WindowChrome>
<Grid Background="Purple"
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Height="62"
>
<TextBlock>Hi there!</TextBlock>
</Grid>
</Window>
But Rider always throws this error:
JetBrains.ReSharper.Features.XamlRendererExternal.WPF.WpfPreview+WpfPreviewCreationException: Failed to build preview ---> System.Xaml.XamlDuplicateMemberException: "Свойство "WindowChrome" уже задано для "PreviewRootControl".": номер строки "22" и позиция в строке "7".
в System.Xaml.XamlObjectWriter.Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx)
в System.Xaml.XamlObjectWriter.WriteEndObject()
в System.Xaml.XamlObjectWriter.Dispose(Boolean disposing)
в System.Xaml.XamlWriter.System.IDisposable.Dispose()
в JetBrains.ReSharper.Features.XamlRendererExternal.WPF.PreviewXamlWriter`1.Dispose(Boolean disposing)
в System.Xaml.XamlWriter.System.IDisposable.Dispose()
в JetBrains.ReSharper.Features.XamlRendererExternal.WPF.WpfPreview.Create(String xaml, FileSystemPath assembliesRoot, FileSystemPath primaryAssemblyPath, IDictionary`2 aliasToAssembliesMap)
--- Конец трассировки внутреннего стека исключений ---
в JetBrains.ReSharper.Features.XamlRendererExternal.WPF.WpfPreview.Create(String xaml, FileSystemPath assembliesRoot, FileSystemPath primaryAssemblyPath, IDictionary`2 aliasToAssembliesMap)
в JetBrains.ReSharper.Features.XamlRendererExternal.XamlPreviewSessionProcessor.<Initialize>g__OnXamlMarkupUpdate7_0(XamlMarkup markup)
Visual Studio 2017 works correctly with that but Rider doesn't. It's really sad because I bought Rider to work more comfortably and still I'm forced to work in VS because of this.
Looks like it's a Rider bug. Any thoughts?
Please sign in to leave a comment.

Hi, Konstantin.
Thank you for contacting us.
Here is an issue in our tracker. Could you please attach a sample project and describe steps for repro at that issue.
Also, please, collect and attach logs (Help|Compress Logs and Show in Explorer).
I tried to reproduce the problem but no luck. So we need more information.
It would be great if you help us to investigate this problem.
Thanks in advance
Kind regards,
Sofia.
Good Day
I know this has been posted more than a year ago. But I can confirm the issue still persist. From what I can see is when creating your own custom window using Window Chrome Rider is not able to show the preview my code is exactly like the OP's and removing the properties of Window Chrome makes the preview work again. But this causes one not to be able to see a preview of the custom window and you have to build each time and see what it looks like at run time. Meaning this specific code.
Hi there,
We reproduced the issue.
Here is the relevant ticket on youtrack. Please follow it for further updates.
I'm sorry for the inconveniences.
Sofia.