In Water C# code, when the file is reformatted (Edit -> Reformat File), I think the finally blocks are indented incorrectly (at least different than the catch blocks).
Yes, seems to happen in any context. The indenting happens correctly initially while typing and adding the curly braces, but if something signals a reformat, or if you choose it from the edit menu, the finally curlys get indented more.
Water test case:
File -> New Project -> Echos -> Winforms
Then modify Program.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace WindowsApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += OnThreadException;
using (MainForm lMainForm = new MainForm())
{
Application.Run(lMainForm);
}
try
{
// try something
}
catch (Exception e)
{
// oops
}
try
{
// do something else
}
finally
{
// done with something else
}
}
void OnThreadException(Object sender, ThreadExceptionEventArgs e)
{
System.Windows.Forms.MessageBox.Show(e.Exception.Message);
}
}
}
Then go to Edit -> Reformat File, and you will get this:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Windows.Forms;
namespace WindowsApplication
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.ThreadException += OnThreadException;
using (MainForm lMainForm = new MainForm())
{
Application.Run(lMainForm);
}
try
{
// try something
}
catch (Exception e)
{
// oops
}
try
{
// do something else
}
finally
{
// done with something else
}
}
void OnThreadException(Object sender, ThreadExceptionEventArgs e)
{
System.Windows.Forms.MessageBox.Show(e.Exception.Message);
}
}
}
glad the editing part is fine, coz that’s my code in water ;). the reformat is done my the manager project system, and that’s out of my hand to fix or worry about ;).
ps: some new editor features in 2345. let me know what you think!
Hello,
I couldn’t reproduce the problem with reformatting here. Two weeks ago I had that bug logged, and I fixed it on Nov 9. So if you have the earlier build, could you please download latest and check with it. If you’ve got recent up-to-date elements, please give me some video on how you are reproducing the problem.
Thanks in advance.
After going to Edit -> Reformat File the final curly brace will indent itself too far. Curiously enough, the first curly brace in the finally block stays put now.
Let me know if that doesn’t show the problem for you and I will try to figure out how to do a video of some sort.