Bug 11196 - Cannot change the code formatting policy
Summary: Cannot change the code formatting policy
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Project Management ()
Version: 4.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: (C7)
Assignee: Matt Ward
Depends on:
Reported: 2013-03-15 17:40 UTC by Mike Desaro
Modified: 2016-10-11 14:04 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Video showing the policy setting not persisting (790.14 KB, video/quicktime)
2013-03-15 17:40 UTC, Mike Desaro

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Mike Desaro 2013-03-15 17:40:45 UTC
Created attachment 3629 [details]
Video showing the policy setting not persisting

Changing the code formatting setting either via the solution options, project options or via the Apply Policy menu item does not persist.

Steps to reproduce:

- change the code formatting policy via solution options to a custom policy
- click the OK button
- open the solution options and notice that it reverted back to "Custom"
Comment 1 Darren Cook 2014-11-26 07:36:55 UTC
I believe I am experiencing the same bug. MonoDevelop 4.0.12 on Mint 17 Linux.

I apply my custom policy by: Project|Apply Policy. I leave the "Apply stock or custom policy set" radio button checked, and choose my custom policy from the bottom of the drop-down list. Then I click "Apply policies".

It works (the policy only says to use 4 spaces for tabs), as I can see by pressing a tab in the editor window, and getting spaces. I then close the solution, open it again, and we are back to "Mono" policy, which I can see as now tab gives me a tab character.

I've tried right-clicking either the solution, or the project, Tools sub-menu, and trying to apply the policy that way. But whether applied to the solution, or the project, it does not last beyond the current session each time.

Also, I would increase importance from Normal to High: MonoDevelop is a great editor/IDE, but it is getting tedious having to re-apply this every time I open it (as well as then search and replace the tabs, already typed without realizing, into spaces), and I am personally leaning towards using an external editor. For people who do more in their custom policy it must be even more annoying.
Comment 2 xamarin-release-manager 2015-12-10 16:40:13 UTC
Fixed in version (master)

Author: Matt Ward
Commit: 12faaaf90d7391d80bcdb3c6667d6a170f22b320 (mono/monodevelop)
Comment 3 Matt Ward 2015-12-10 16:43:00 UTC
I was unable to reproduce the problem with the policy not being saved when changing it in the project or solution options with Xamarin Studio 5.10. However I can reproduce the problem in comment #c1 where the Project - Apply Policy dialog does not save the settings in the solution or project file.
Comment 5 Kamyar Ghandi 2016-10-11 13:54:44 UTC
Using Xamarin Community Studio 6.1.1 (build 15) this bug is still present.

When changing Code Formatting Policy on the Solution, only the setting for one file type persists. So for example, if I change formatting policy for C#, razor, and VB to Microsoft Visual Studio, only the policy for one of those file types is saved.

The problem only becomes apparent after you quit Xamarin and then reload the solution.

Editing the policy on projects appears to work. It is only an issue with Solution policies.
Comment 6 Matt Ward 2016-10-11 13:58:01 UTC
@Kamyar - Would you be able to open a new bug for what you are seeing?
Comment 7 Kamyar Ghandi 2016-10-11 14:04:45 UTC
Done. Bug 45274.