T O P I C R E V I E W |
Uniwares |
Posted - Nov 26 2021 : 10:26:58 AM The "modify expression" menu entry sometimes shows up in unexpected locations and then produces even more unexpected results. Like here, invoked on a method definition:
Seems that VA really likes the #region's, they often pop up in the modify expression window. |
7 L A T E S T R E P L I E S (Newest First) |
feline |
Posted - Dec 23 2021 : 09:16:05 AM I have the test file, many thanks for this, I am now able to easily reproduce on demand. You actually need an assignment in the region above, at least for me, which is what I was missing.
case=147571 |
Uniwares |
Posted - Dec 23 2021 : 08:04:35 AM Sent by email |
feline |
Posted - Dec 14 2021 : 12:40:44 PM If you are happy sharing the file, that would be quite interesting and useful please. Modify Expression is still offered in a few places that don't make much sense, but this really doesn't make any sense, so something is clearly confusing us. It would be nice to distil this down to a tiny test case, if possible.
Please send me the files via email:
[email protected]
including this thread ID or URL in the description, so we can match it up. |
Uniwares |
Posted - Dec 03 2021 : 07:21:51 AM Yes, sorry, didnt put any context to it: VS 2017 enterprise, VA current version, C# ASP.NET project.
As you can see, hovering over a method name gives me the refactoring menu icon, and there is "modify expression" available.
This specific .cs file has regions all over, some outside the methods, some inside. the "[ INIT ]" region is the second region in this file, inside the class, surrounding a few methods. And for any method in this file, this specific region is shown when invoking the "modify expression".
I�ll send you the code for this file if needed. |
feline |
Posted - Dec 03 2021 : 07:02:33 AM I am assuming this is C# code, so I have used the following test case, using VS2019 and VA 2440.0:
namespace VAModifyExpressionTest
{
class HoldingTest
{
#region [INIT]
/// <summary>
/// Gets the regional month names
/// </summary>
/// <param name="val">unused</param>
/// <param name="purposeOneVal">unused</param>
/// <param name="purposeValTwo">unused</param>
/// <param name="locationVal">unused</param>
/// <returns>A string with all month names</returns>
[WebMethod(CacheDuration = 60)]
[ScriptMethod]
public static string Month(string val, string purposeOneVal, string purposeValTwo, string locationVal)
{
return DateUtils.GetAllMonthNamesAsCsv();
}
#endregion
#region [MORE INIT]
#endregion
}
} the only place on the function signature that Modify Expression is being offered for me is on the parameters, where it is offering to place a ! in front of the parameter type. A rather random idea, but at least it makes some sense given the location where it is triggered.
Am I testing this correctly? |
Uniwares |
Posted - Dec 03 2021 : 05:42:03 AM /// <summary>
/// Gets the regional month names
/// </summary>
/// <param name="val">unused</param>
/// <param name="purposeOneVal">unused</param>
/// <param name="purposeValTwo">unused</param>
/// <param name="locationVal">unused</param>
/// <returns>A string with all month names</returns>
[WebMethod(CacheDuration = 60)]
[ScriptMethod]
public static string Month(string val, string purposeOneVal, string purposeValTwo, string locationVal)
{
return DateUtils.GetAllMonthNamesAsCsv();
}
But it actually doesnt matter, there are 3 other regions (and about 500 lines of code) between this method and the one shown in the dialog. Happens with pretty much any method after the region statement. |
feline |
Posted - Nov 29 2021 : 4:45:31 PM What method definition did you trigger this on? The screen shot isn't offering any clues. |
|
|