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
 VA 2385: suggesting wrong new type
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Sep 04 2020 :  11:38:41 AM  Show Profile  Reply with Quote




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.

feline
Whole Tomato Software

United Kingdom
18746 Posts

Posted - Sep 04 2020 :  1:11:57 PM  Show Profile  Reply with Quote
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.

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

Uniwares
Tomato Guru

Portugal
2320 Posts

Posted - Sep 04 2020 :  1:53:32 PM  Show Profile  Reply with Quote
Happens just here, not seen yet somewhere else.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18746 Posts

Posted - Sep 07 2020 :  2:03:20 PM  Show Profile  Reply with Quote
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.

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