Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Technical Support
 Modify expression hickups
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Nov 26 2021 :  10:26:58 AM  Show Profile  Reply with Quote
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.

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Nov 29 2021 :  4:45:31 PM  Show Profile  Reply with Quote
What method definition did you trigger this on? The screen shot isn't offering any clues.

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Dec 03 2021 :  05:42:03 AM  Show Profile  Reply with Quote
/// <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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Dec 03 2021 :  07:02:33 AM  Show Profile  Reply with Quote
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?

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Dec 03 2021 :  07:21:51 AM  Show Profile  Reply with Quote
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.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Dec 14 2021 :  12:40:44 PM  Show Profile  Reply with Quote
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.

zen is the art of being at one with the two'ness
Go to Top of Page

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Dec 23 2021 :  08:04:35 AM  Show Profile  Reply with Quote
Sent by email
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18749 Posts

Posted - Dec 23 2021 :  09:16:05 AM  Show Profile  Reply with Quote
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

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000