Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 VA 2385: suggesting wrong new type

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
Uniwares Posted - Sep 04 2020 : 11:38:41 AM




The UserMovement class is:
	[Table("UserMovements")]
	public class UserMovement
	{
		public UserMovement() { }

		public UserMovement(UserReference user) { Number = user.Number; }
		public UserMovement(int number) { Number = number; }

		[Column("id")]
		[Key]
		[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
		public int ID { get; }

		[Column("Login", TypeName = "datetime")]
		public DateTime Login { get; set; }

		[Column("Logout", TypeName = "datetime")]
		public DateTime Logout { get; set; }

		[Column("Number")]
		public int Number { get; set; }
	}


The User class is a similar class, but with more user details. The UserReference class is just a placeholder for the User class and contains only one member: Number which is the reference to the User record in the database. It has implicit conversion operators so it can be used in place of the User class or an integer.
So why VA would suggest a "new User" when the "Login" member is of type DateTime, no idea.
3   L A T E S T    R E P L I E S    (Newest First)
feline Posted - Sep 07 2020 : 2:03:20 PM
Assuming this is reliable, any chance of a copy of the file? Hopefully I will get the same result here, and can then simplify the file down, to try and get a simple reliable example.
Uniwares Posted - Sep 04 2020 : 1:53:32 PM
Happens just here, not seen yet somewhere else.
feline Posted - Sep 04 2020 : 1:11:57 PM
This looks a lot like the listbox in the switch statement bug, in that VA is confused about the current scope, but so far I cannot reproduce this here.

Is this something that is happening on demand?
Are you seeing it with other places where you are initialising class instances?

I am wondering if I am just not testing this just right, or if the surrounding context / code is somehow a factor.

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000