In my case it was because of the length of the database field is less than the length of the input field.
database table
create table user(
Username nvarchar(5) not null
);
My input
User newUser = new User()
{
Username = "123456"
};
the value for Username
length
is 5 which is lessthan
6
...this may help someone