XamlStyler
XamlStyler copied to clipboard
Resharper Template: Error in StylerPackage
Describe the bug On hitting save, the XAML Styler tries to format the template from Resharper
To Reproduce Steps to reproduce the behavior:
- Open the Template Explorer of Resharper
- Create a new template
- Write anything, doesn't matter.
Expected behavior I do not expect the XAML Styler to check this.
Screenshots
If applicable, add screenshots to help explain your problem.

Version Info (please complete the following information):
- OS: Windows 10 Enterprise 2016 LTSB 64-bit (10.0, Build 14393)
- Visual Studio: VS 2017 Version 15.9.22
- XAML Styler: Version 3.2003.9
Thanks for reporting this!
looks like this only happens when a XAML based solution is opened, I can't reproduce it when I have an ASP.net project open for example, but I can with WPF project open. We'll investigate!
Any news on this one?
thanks for the ping @MarkSandy unfortunately no news on this.
@maartenba do you have an idea why ReSharper template editor would trigger XAML Styler?
Let me see if I can find anyone in the team who can shed some light on this...
Looks like XamlStyler will have to do some additional checks on the document that is open. Probably with the debugger attached, check if any of your checks (e.g. these https://github.com/Xavalon/XamlStyler/blob/master/src/XamlStyler.Extension.Windows/Extensions/DocumentExtensions.cs) should be extended with additional conditions based on Document properties.
I guess still no news on this?
I'm now running VS2022 and unfortunately I still epxerience it.
Just want to add, that even though the message box appears, the document itself get's saved. But it's annoying.
Another thing I noticed: when saving all changes, not just per file, with shortcut CTRL + Shift + S the error does not appear.
Very frustrating little bug here
@maartenba could you help us out with a PR, after you nailed down the cause? Would really appreciate it!
https://github.com/Xavalon/XamlStyler/issues/278#issuecomment-839497505 is what I was advised back then, not sure how though 😅
Unfortunate. ;)
Close, as it was solved by #453.